Skip to content

Commit

Permalink
Merge pull request #103 from zalando/bugfix/change_configuration_vari…
Browse files Browse the repository at this point in the history
…able_name

Configuration can be set with $SPILO_CONFIGURATION.
  • Loading branch information
Oleksii Kliukin committed Nov 7, 2016
2 parents 7a2d2d6 + f66135e commit 117674d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions postgres-appliance/configure_spilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def get_dcs_config(config, placeholders):
config = {'etcd': defaults['etcd']}
config['etcd']['discovery_srv'] = placeholders['ETCD_DISCOVERY_DOMAIN']
else:
pass # Configuration can also be specified using PATRONI_CONFIGURATION
pass # Configuration can also be specified using either SPILO_CONFIGURATION or PATRONI_CONFIGURATION

return config

Expand Down Expand Up @@ -459,9 +459,10 @@ def main():
config = yaml.load(pystache_render(TEMPLATE, placeholders))
config.update(get_dcs_config(config, placeholders))

user_config = yaml.load(os.environ.get('PATRONI_CONFIGURATION', '')) or {}
user_config = yaml.load(os.environ.get('SPILO_CONFIGURATION', os.environ.get('PATRONI_CONFIGURATION', ''))) or {}
if not isinstance(user_config, dict):
raise ValueError('PATRONI_CONFIGURATION should contain a dict, yet it is a {}'.format(type(user_config)))
config_var_name = 'SPILO_CONFIGURATION' if 'SPILO_CONFIGURATION' in os.environ else 'PATRONI_CONFIGURATION'
raise ValueError('{0} should contain a dict, yet it is a {}'.format(config_var_name, type(user_config)))

config = deep_update(user_config, config)

Expand Down

0 comments on commit 117674d

Please sign in to comment.