Files
project-manager/project_manager/common/util.py
T
shmyga b459eef34b
test / test (push) Successful in 2m20s
feat(preset): add gitea preset
2026-10-03 16:34:32 +03:00

25 lines
562 B
Python

import os
from pathlib import Path
import dotenv
def merge_dicts(target: dict, enhancer: dict) -> dict:
for key, val in enhancer.items():
if key not in target:
target[key] = val
continue
if isinstance(val, dict):
merge_dicts(target[key], val)
else:
target[key] = val
return target
def get_environ(path: Path) -> dict[str, str]:
result = os.environ.copy()
if (env_file := path / ".env").exists():
result.update(dotenv.dotenv_values(env_file))
return result