aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-04-03 22:17:05 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-04-03 22:17:05 +0200
commit4935bee70b4a6b08ea98d03210065c0ce74cdc0e (patch)
treebe86b525661389b4fc92659c0c26f1f19876f112
parentfixed erros reported by flake. (diff)
downloadnewspipe-4935bee70b4a6b08ea98d03210065c0ce74cdc0e.tar.gz
newspipe-4935bee70b4a6b08ea98d03210065c0ce74cdc0e.tar.bz2
newspipe-4935bee70b4a6b08ea98d03210065c0ce74cdc0e.zip
Simplify loading of the configuration file.
-rw-r--r--newspipe/bootstrap.py7
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)
bgstack15