From 2e4758a3e877cd8de278da09cd3e3e1639f1ef7d Mon Sep 17 00:00:00 2001 From: Difrex Date: Tue, 9 Aug 2016 16:15:45 +0300 Subject: [PATCH] get discovery group from OS environment --- surok/discovery.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/surok/discovery.py b/surok/discovery.py index fc28ea1..5f93c9b 100644 --- a/surok/discovery.py +++ b/surok/discovery.py @@ -8,12 +8,18 @@ def resolve(app, conf): services = app['services'] domain = conf['domain'] group = None + + if app['env'].get('SUROK_DISCOVERY_GROUP') is not None: + group = app['env']['SUROK_DISCOVERY_GROUP'] + for service in services: hosts[service['name']] = [] - if app['env'].get('SUROK_GROUP') is not None: - group = app['env']['SUROK_GROUP'] + + if group is not None: + pass else: group = service['group'] + try: for rdata in dns.resolver.query('_' + service['name'] + '.' +