Skip to content
Snippets Groups Projects
Commit 9d146a5c authored by Antoine Lambert's avatar Antoine Lambert
Browse files

api.server: Move config parsing in make_app_from_configfile

parent 3eee4008
No related branches found
No related tags found
1 merge request!42api.server: Fix client_max_size parameter transmission to aiohttp
......@@ -199,12 +199,7 @@ def make_app(backend, **kwargs):
return app
def get_local_backend(config_file):
if os.path.isfile(config_file):
cfg = config.read(config_file, DEFAULT_CONFIG)
else:
cfg = config.load_named_config(config_file, DEFAULT_CONFIG)
def get_local_backend(cfg):
if 'vault' not in cfg:
raise ValueError("missing '%vault' configuration")
......@@ -231,7 +226,11 @@ def get_local_backend(config_file):
def make_app_from_configfile(config_file=DEFAULT_CONFIG_PATH, **kwargs):
config_file = os.environ.get('SWH_CONFIG_FILENAME', config_file)
vault = get_local_backend(config_file)
if os.path.isfile(config_file):
cfg = config.read(config_file, DEFAULT_CONFIG)
else:
cfg = config.load_named_config(config_file, DEFAULT_CONFIG)
vault = get_local_backend(cfg)
return make_app(backend=vault, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment