fix: Correct dotenv loading to use dynamic directory based on execution context
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
load_dotenv(override=True)
|
extDataDir = os.getcwd()
|
||||||
|
if getattr(sys, "frozen", False):
|
||||||
|
extDataDir = sys._MEIPASS
|
||||||
|
load_dotenv(dotenv_path=os.path.join(extDataDir, ".env"))
|
||||||
|
|
||||||
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper()
|
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper()
|
||||||
LOG_PATH = os.getenv("LOG_PATH", "/tmp/logs/thechart")
|
LOG_PATH = os.getenv("LOG_PATH", "/tmp/logs/thechart")
|
||||||
|
|||||||
Reference in New Issue
Block a user