WIP consumers in gen-config.

master
Luka Vandervelden 2019-10-27 22:11:07 +01:00
parent 12cb9ee4dd
commit ff4c1cc08d
1 changed files with 13 additions and 0 deletions

View File

@ -50,6 +50,7 @@ class GenConfig::Context
def generate(template, target : String, options : Hash(String, Variables))
ServiceDefinition.load SERVICES_DIRECTORY
Service.load RC_DIRECTORY
Environment.load ENVIRONMENTS_DIRECTORY
target_file = File.open target, "w"
@ -99,6 +100,18 @@ class GenConfig::Context
end
end
options["providers"] = providers
consumers = Hash(String, Variables).new
service.provides.each do |provider_data|
token = provider_data.token
consumers[token] = Service.all.select do |s2|
s2.providers.each do |t2, id|
token == t2 && id == service.id
end
end.map &.full_id
end
options["consumers"] = consumers
end
end