Grooming.

master
Luka Vandervelden 2019-10-28 05:46:44 +01:00
parent 0c720683f6
commit a29db9142a
1 changed files with 14 additions and 17 deletions

View File

@ -7,6 +7,18 @@ def sanitize_path(path)
path.gsub /\/\/+/, "/" path.gsub /\/\/+/, "/"
end end
class Service
def to_genconfig
Hash(String, String?).new.tap do |entry|
entry["name"] = name
entry["id"] = full_id
entry["environment"] = environment.name
entry["root"] = root
entry["domain"] = domain
end
end
end
module GenConfig module GenConfig
# FIXME: The fuck has this become. # FIXME: The fuck has this become.
alias Variables = alias Variables =
@ -96,14 +108,7 @@ class GenConfig::Context
next unless provider next unless provider
# FIXME: deduplicate providers[token] = provider.to_genconfig
providers[token] = Hash(String, String?).new.tap do |entry|
entry["name"] = provider.name
entry["id"] = provider.full_id
entry["environment"] = provider.environment.name
entry["root"] = provider.root
entry["domain"] = provider.domain
end
end end
options["providers"] = providers options["providers"] = providers
@ -118,15 +123,7 @@ class GenConfig::Context
t == token && service.is_id?(provider) t == token && service.is_id?(provider)
end end
.size.>(0)) .size.>(0))
.map do |consumer| .map &.to_genconfig
Hash(String, String?).new.tap do |entry|
entry["name"] = consumer.name
entry["id"] = consumer.id
entry["environment"] = consumer.environment.name
entry["root"] = consumer.root
entry["domain"] = consumer.domain
end
end
end end
options["consumers"] = consumers options["consumers"] = consumers
end end