INNER CODE UNIT · Python
build_cmd_env
bunkerity/bunkerweb · src/scheduler/main.py:195
def build_cmd_env() -> Dict[str, str]:
"""Environment handed to the gen/ and save_config subprocesses.
The logging variables have to travel with it. Without them the child falls back to
LOG_TYPES=stderr, so on Linux -- where the scheduler runs with LOG_TYPES=file -- every
error the config saver reports lands in journald while the scheduler log file only keeps
the one-line "failed" summary, which reads as "no logs at all".
"""
cmd_env = {
"PATH": getenv("PATH", ""),
"PYTHONPATH": getenv("PYTHONPATH", ""),
"LOG_LEVEL": getenv("LOG_LEVEL", ""),
"DATABASE_URI": getenv("DATABASE_URI", ""),
}
# Forwarded only when set. An empty CUSTOM_LOG_LEVEL is not "unset" to the child, it is an
# override that hides LOG_LEVEL and drops it back to INFO, and SCHEDULER_LOG_TO_FILE has to
# travel too or a file-logging child with no explicit path falls back to stderr.