Fix .env override priority and password whitespace stripping
Change load_dotenv() to load_dotenv(override=False) so real environment variables always take priority over stale .env files. This prevents a hardcoded or outdated REDMINE_API_KEY in .env from silently overriding a fresh token exported in the shell (#15). Add .strip() to get_redmine_password() for consistency with all other config getters — trailing whitespace in .env no longer causes silent auth failures (#35). Closes #15, closes #35
This commit is contained in:
@@ -3,7 +3,7 @@ from typing import Union
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
load_dotenv(override=False)
|
||||
|
||||
DEFAULT_REDMINE_VERIFY = "/etc/ssl/certs/ca-certificates.crt"
|
||||
FALSE_VALUES = {"0", "false", "no", "off"}
|
||||
@@ -25,7 +25,7 @@ class Config:
|
||||
|
||||
@classmethod
|
||||
def get_redmine_password(cls) -> str:
|
||||
return os.getenv("REDMINE_PASSWORD", "")
|
||||
return os.getenv("REDMINE_PASSWORD", "").strip()
|
||||
|
||||
@classmethod
|
||||
def get_redmine_verify(cls) -> Union[bool, str]:
|
||||
|
||||
Reference in New Issue
Block a user