From 8af2f5b99e3507d99abc2f15b60e6073bfd297b3 Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Thu, 30 Aug 2018 11:56:46 -0400 Subject: [PATCH] Add ability to override any config setting via ENV var --- atst/app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/atst/app.py b/atst/app.py index f0e5ffc6..aa6a8158 100644 --- a/atst/app.py +++ b/atst/app.py @@ -114,6 +114,13 @@ def make_config(): # ENV_CONFIG will override values in BASE_CONFIG. config.read(config_files) + # Check for ENV variables as a final source of overrides + # ENV vars must be named "ATST_" + for confsetting in config.options("default"): + env_override = os.getenv("ATST_" + confsetting.upper()) + if env_override: + config.set("default", confsetting, env_override) + # Assemble DATABASE_URI value database_uri = ( "postgres://"