allow empty conf/stack in nginx config generation

needed for QE users that may not have one yet
This commit is contained in:
Evan Cordell 2017-02-23 15:10:35 -05:00
parent 0003022549
commit f42200a303

View file

@ -28,8 +28,12 @@ def generate_server_config(config):
"""
Generates server config from the app config
"""
tuf_server = config.get('TUF_SERVER', None)
signing_enabled = config.get('FEATURE_SIGNING', False)
if config:
tuf_server = config.get('TUF_SERVER', None)
signing_enabled = config.get('FEATURE_SIGNING', False)
else:
tuf_server = None
signing_enabled = False
write_config('conf/nginx/server-base.conf',
tuf_server=tuf_server,
@ -37,7 +41,10 @@ def generate_server_config(config):
if __name__ == "__main__":
with open('conf/stack/config.yaml', 'r') as f:
config = yaml.load(f)
if os.path.exists('conf/stack/config.yaml'):
with open('conf/stack/config.yaml', 'r') as f:
config = yaml.load(f)
else:
config = None
generate_server_config(config)
generate_nginx_config()