Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The entire application is two Python files:

Three-layer priority (lowest to highest): `config.yaml` → environment variables → CLI arguments.

Environment variables use `_` as separator (e.g., `DOCKER_HOST`, `TRAEFIK_CONTAINERNAME`). CLI arguments use `.` separator with `--` prefix (e.g., `--docker.host`, `--traefik.containername`).
Environment variables use `_` as separator (e.g., `DOCKER_HOST`, `TRAEFIK_CONTAINERNAME`). CLI arguments use `.` separator with `--` prefix (e.g., `--docker.host`, `--traefik.containername`). The general log level can be set via the shorthand `LOGLEVEL` env var (`LOGLEVEL_GENERAL` is also supported for backward compatibility).

## Versioning & CI/CD

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ CLI arguments > environment variables > config.yaml
| --- | --- | --- | --- |
| Traefik container name | `TRAEFIK_CONTAINERNAME` | `--traefik.containername` | `traefik` |
| Docker socket/host | `DOCKER_HOST` | `--docker.host` | Unix socket |
| General log level | `LOGLEVEL` | `--loglevel.general` | `INFO` |
| App log level | `LOGLEVEL_APPLICATION` | `--loglevel.application` | `DEBUG` |
| Monitored label (regex) | `TRAEFIK_MONITOREDLABEL` | `--traefik.monitoredlabel` | `^traefik.enable$` |
| Network label | `TRAEFIK_NETWORKLABEL` | `--traefik.networklabel` | `traefik.docker.network` |
Expand All @@ -138,7 +139,7 @@ docker:
key: "/path/to/key.pem"

logLevel:
general: "INFO" # third-party libraries
general: "INFO" # third-party libraries (env: LOGLEVEL or LOGLEVEL_GENERAL)
application: "DEBUG" # this daemon

traefik:
Expand Down
7 changes: 7 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ def apply_overrides(config, prefix=''):

apply_overrides(config)

# Support LOGLEVEL as a shorthand for LOGLEVEL_GENERAL (backward compatible)
loglevel_env = os.environ.get("LOGLEVEL")
if loglevel_env is not None and "logLevel" in config:
# LOGLEVEL_GENERAL takes priority over LOGLEVEL if both are set
if "LOGLEVEL_GENERAL" not in {k.upper() for k in os.environ}:
config["logLevel"]["general"] = loglevel_env

def init_loggers(config: Config) -> logging.Logger:
"""
Initializes logging based on the configuration.
Expand Down
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ docker:
# Logging Configuration (Possible values : "DEBUG", "INFO", "WARN", "ERROR", "FATAL")
logLevel:
# General logging level for all libraries etc
# Environment variable: LOGLEVEL (or LOGLEVEL_GENERAL for backward compatibility)
general: "INFO"
# This application specific logging level
application: "DEBUG"
Expand Down
Loading