From 5c14389e9de4b050f8abdb5efadfc1177b1acce5 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Thu, 6 Jun 2024 17:12:31 +0200 Subject: [PATCH] read dot_env from path --- xexe/cli.py | 2 +- xexe/constants.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xexe/cli.py b/xexe/cli.py index c090212..f3fd0a2 100644 --- a/xexe/cli.py +++ b/xexe/cli.py @@ -16,7 +16,7 @@ logging.basicConfig( logger = logging.getLogger() -load_dotenv() +load_dotenv(dotenv_path=PATHS.dot_env_file_path, verbose=True) @click.group() diff --git a/xexe/constants.py b/xexe/constants.py index 78f03f0..9c73e49 100644 --- a/xexe/constants.py +++ b/xexe/constants.py @@ -5,3 +5,6 @@ from dataclasses import dataclass @dataclass class PATHS: logging_file: pathlib.Path = pathlib.Path("xexe.log") + # Expand user is important. It will replace the user and give you the full + # path. Stuff breaks without it. + dot_env_file_path: pathlib.Path = pathlib.Path("~/.xexe/.env").expanduser()