From 4163d2eb130f17f526e8abeacd01c929896f4fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Tue, 1 Nov 2022 12:56:07 +0100 Subject: [PATCH] Stop using the deprecated FLASK_ENV environment variable --- CHANGES.rst | 6 ++++++ canaille/__init__.py | 2 +- demo/Procfile | 6 +++--- demo/docker-compose.yml | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 909d56b4..96dbd163 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,12 @@ Added - Python 3.11 support. :pr:`61` +Changed +******* + +- Replaced the use of the deprecated `FLASK_ENV` environment variable by + `FLASK_DEBUG`. + [0.0.12] - 2022-10-24 ===================== diff --git a/canaille/__init__.py b/canaille/__init__.py index 349d2b75..83dd692d 100644 --- a/canaille/__init__.py +++ b/canaille/__init__.py @@ -42,7 +42,7 @@ def setup_config(app, config=None, validate=True): "Either create conf/config.toml or set the 'CONFIG' variable environment." ) - if os.environ.get("FLASK_ENV") == "development": + if app.debug: canaille.installation.setup_keypair(app.config) if validate: diff --git a/demo/Procfile b/demo/Procfile index 5f7ff816..118e07fb 100644 --- a/demo/Procfile +++ b/demo/Procfile @@ -1,4 +1,4 @@ slapd: ./slapd.sh -canaille: env AUTHLIB_INSECURE_TRANSPORT=1 FLASK_ENV=development CONFIG=conf/canaille.toml FLASK_APP=../../canaille flask run --extra-files conf/canaille.toml -client1: env FLASK_ENV=development CONFIG=../conf/client1.cfg FLASK_APP=client flask run --port=5001 -client2: env FLASK_ENV=development CONFIG=../conf/client2.cfg FLASK_APP=client flask run --port=5002 +canaille: env FLASK_DEBUG=1 AUTHLIB_INSECURE_TRANSPORT=1 CONFIG=conf/canaille.toml FLASK_APP=../../canaille flask run --extra-files conf/canaille.toml +client1: env FLASK_DEBUG=1 CONFIG=../conf/client1.cfg FLASK_APP=client flask run --port=5001 +client2: env FLASK_DEBUG=1 CONFIG=../conf/client2.cfg FLASK_APP=client flask run --port=5002 diff --git a/demo/docker-compose.yml b/demo/docker-compose.yml index 2cb962c2..c22812f9 100644 --- a/demo/docker-compose.yml +++ b/demo/docker-compose.yml @@ -26,7 +26,7 @@ services: dockerfile: demo/Dockerfile-canaille environment: - AUTHLIB_INSECURE_TRANSPORT=1 - - FLASK_ENV=development + - FLASK_DEBUG=1 - CONFIG=/opt/canaille/conf/canaille.toml - FLASK_APP=canaille volumes: @@ -42,7 +42,7 @@ services: context: . dockerfile: Dockerfile-client environment: - - FLASK_ENV=development + - FLASK_DEBUG=1 - CONFIG=/opt/client/conf/client1.cfg - FLASK_APP=client volumes: @@ -60,7 +60,7 @@ services: context: . dockerfile: Dockerfile-client environment: - - FLASK_ENV=development + - FLASK_DEBUG=1 - CONFIG=/opt/client/conf/client2.cfg - FLASK_APP=client volumes: