From d2b2737bf7d91b4454189aa9a83bfadd1a8e8716 Mon Sep 17 00:00:00 2001 From: Johannes Alneberg Date: Mon, 22 Apr 2024 16:58:54 +0200 Subject: [PATCH] Moved dotenv loading inside config __init__ since it didn't work as it was --- daily_read/__main__.py | 2 -- daily_read/config.py | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/daily_read/__main__.py b/daily_read/__main__.py index 2bfad8a..647959e 100644 --- a/daily_read/__main__.py +++ b/daily_read/__main__.py @@ -11,7 +11,6 @@ # Installed import click from dateutil.relativedelta import relativedelta -import dotenv from rich.logging import RichHandler # Own @@ -22,7 +21,6 @@ import daily_read.utils -dotenv.load_dotenv() config_values = daily_read.config.Config() rich_handler = RichHandler() diff --git a/daily_read/config.py b/daily_read/config.py index 92581d4..2bc77c8 100644 --- a/daily_read/config.py +++ b/daily_read/config.py @@ -1,8 +1,11 @@ import os +import dotenv + class Config(object): def __init__(self): + dotenv.load_dotenv() self.ORDER_PORTAL_URL = os.getenv("DAILY_READ_ORDER_PORTAL_URL") self.ORDER_PORTAL_API_KEY = os.getenv("DAILY_READ_ORDER_PORTAL_API_KEY") self.REPORTS_LOCATION = os.getenv("DAILY_READ_REPORTS_LOCATION")