diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-04-03 22:17:05 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-04-03 22:17:05 +0200 |
commit | 4935bee70b4a6b08ea98d03210065c0ce74cdc0e (patch) | |
tree | be86b525661389b4fc92659c0c26f1f19876f112 | |
parent | fixed erros reported by flake. (diff) | |
download | newspipe-4935bee70b4a6b08ea98d03210065c0ce74cdc0e.tar.gz newspipe-4935bee70b4a6b08ea98d03210065c0ce74cdc0e.tar.bz2 newspipe-4935bee70b4a6b08ea98d03210065c0ce74cdc0e.zip |
Simplify loading of the configuration file.
-rw-r--r-- | newspipe/bootstrap.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/newspipe/bootstrap.py b/newspipe/bootstrap.py index 2e084a55..70512493 100644 --- a/newspipe/bootstrap.py +++ b/newspipe/bootstrap.py @@ -48,13 +48,14 @@ def set_logging( # Create Flask application application = Flask(__name__, instance_relative_config=True) -if os.environ.get("Newspipe_TESTING", False) == "true": +configuration = os.environ.get("Newspipe_CONFIG", False) +if configuration == "testing": application.debug = logging.DEBUG application.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:" application.config["TESTING"] = True -elif os.environ.get("Newspipe_CONFIG", False): +elif configuration: # if the configuration file is specified via an environment variable - application.config.from_pyfile(os.environ.get("Newspipe_CONFIG"), silent=False) + application.config.from_pyfile(configuration, silent=False) else: try: application.config.from_pyfile("development.py", silent=False) |