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 /\/\/+/, "/"
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
# FIXME: The fuck has this become.
alias Variables =
@ -96,14 +108,7 @@ class GenConfig::Context
next unless provider
# FIXME: deduplicate
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
providers[token] = provider.to_genconfig
end
options["providers"] = providers
@ -118,15 +123,7 @@ class GenConfig::Context
t == token && service.is_id?(provider)
end
.size.>(0))
.map do |consumer|
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
.map &.to_genconfig
end
options["consumers"] = consumers
end