From fdc63b862e2979814c82e1226012d539bc25cab8 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 4 Jan 2023 10:33:57 -0700 Subject: [PATCH] Autoload `whoogle.env` if it exists The whoogle.env file previously needed to be created and enabled using the WHOOGLE_DOTENV var. This removes the second step and loads the env file if it's found during app init. The Dockerfile has also been updated to copy in whoogle.env if it exists. Fixes #909 --- Dockerfile | 3 +-- app/__init__.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9be2ecd..63a8215 100644 --- a/Dockerfile +++ b/Dockerfile @@ -75,8 +75,7 @@ COPY --from=builder /install /usr/local COPY misc/tor/torrc /etc/tor/torrc COPY misc/tor/start-tor.sh misc/tor/start-tor.sh COPY app/ app/ -COPY run . -#COPY whoogle.env . +COPY run whoogle.env* ./ # Create user/group to run as RUN adduser -D -g $DOCKER_USERID -u $DOCKER_USERID $DOCKER_USER diff --git a/app/__init__.py b/app/__init__.py index 7fb05c1..a65be03 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -28,7 +28,7 @@ dot_env_path = ( '../whoogle.env')) # Load .env file if enabled -if read_config_bool('WHOOGLE_DOTENV'): +if os.path.exists(dot_env_path): load_dotenv(dot_env_path) app.enc_key = generate_key()