From b7b4db07b0e55e5c6a99db1539a604d3fcf556bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giovanni=20Lagan=C3=A0?= Date: Sun, 3 Nov 2024 06:46:00 +0100 Subject: [PATCH] fix: env vars are handled in a .env file --- .gitignore | 1 + conf/{prod.py => conf.py} | 0 conf/switch.py | 8 -------- db/connection.py | 2 +- db/queries.py | 2 +- main.py | 2 +- 6 files changed, 4 insertions(+), 11 deletions(-) rename conf/{prod.py => conf.py} (100%) delete mode 100644 conf/switch.py diff --git a/.gitignore b/.gitignore index e4cd442..e7730b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea .DS_Store +.env __pycache__ venv conf/local.py diff --git a/conf/prod.py b/conf/conf.py similarity index 100% rename from conf/prod.py rename to conf/conf.py diff --git a/conf/switch.py b/conf/switch.py deleted file mode 100644 index dec2bf9..0000000 --- a/conf/switch.py +++ /dev/null @@ -1,8 +0,0 @@ -import os - -env = os.getenv('ENV', 'local') - -if env == 'prod': - from conf.prod import * -else: - from conf.local import * \ No newline at end of file diff --git a/db/connection.py b/db/connection.py index e60ff3f..8826882 100644 --- a/db/connection.py +++ b/db/connection.py @@ -1,5 +1,5 @@ import psycopg2 -from conf.switch import host, database, user, password, port +from conf.conf import host, database, user, password, port class Connection: _instance = None diff --git a/db/queries.py b/db/queries.py index d694606..4dd650e 100644 --- a/db/queries.py +++ b/db/queries.py @@ -1,4 +1,4 @@ -from conf.switch import table_name +from conf.conf import table_name from utils.constants import default_target, default_time, default_message from psycopg2 import sql from utils.utils import compute_next_wednesday diff --git a/main.py b/main.py index c7b7929..718f6bb 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ from telegram.ext import CommandHandler, MessageHandler, Filters, Updater -from conf.switch import token, hosting_url, env +from conf.conf import token, hosting_url, env from callbacks.start import start from callbacks.stop import stop from callbacks.set_number import set_number