diff --git a/pub1c-rest.py b/pub1c-rest.py index 2abceb4..0ca0e60 100644 --- a/pub1c-rest.py +++ b/pub1c-rest.py @@ -155,14 +155,18 @@ url_req_parser = reqparse.RequestParser() url_req_parser.add_argument('url', type=str, required=True) -def load_config(filename: str = 'config.yml'): +def load_config(filename: str): with open(filename, 'r', encoding='utf-8') as cfg_file: return yaml.safe_load(cfg_file) +def config_location() -> str: + return os.getenv('WEBPUB1C_CONFIG', 'config.yml') + + def get_config(): if 'config' not in g: - g.config = load_config() + g.config = load_config(config_location()) return g.config