WIP consumers in gen-config.
parent
12cb9ee4dd
commit
ff4c1cc08d
|
@ -50,6 +50,7 @@ class GenConfig::Context
|
||||||
def generate(template, target : String, options : Hash(String, Variables))
|
def generate(template, target : String, options : Hash(String, Variables))
|
||||||
ServiceDefinition.load SERVICES_DIRECTORY
|
ServiceDefinition.load SERVICES_DIRECTORY
|
||||||
Service.load RC_DIRECTORY
|
Service.load RC_DIRECTORY
|
||||||
|
Environment.load ENVIRONMENTS_DIRECTORY
|
||||||
|
|
||||||
target_file = File.open target, "w"
|
target_file = File.open target, "w"
|
||||||
|
|
||||||
|
@ -99,6 +100,18 @@ class GenConfig::Context
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
options["providers"] = providers
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue