Coverage for stepclient_traefik / config.py: 100%
19 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-01-29 02:37 +0000
« prev ^ index » next coverage.py v7.13.2, created at 2026-01-29 02:37 +0000
1import os
2from pydantic_settings import BaseSettings, SettingsConfigDict
3from pydantic import Field, SecretStr
5class Settings(BaseSettings):
6 docker_sock: str = Field(default="/var/run/docker.sock", description="Path to Docker socket")
7 output_dir: str = Field(default="/certificates", description="Directory to write certificates")
8 traefik_yaml_path: str = Field(default="/stepclient.yaml", description="Path to Traefik dynamic configuration file")
10 interval_seconds: int = Field(default=300, description="Interval in seconds between checks")
11 renew_before_hours: int = Field(default=480, description="Renew certificates if they expire within this many hours (default 20 days)")
12 not_after: str = Field(default="1128h", description="Certificate lifetime duration")
14 # Step-CA config
15 step_ca_url: str = Field(..., description="Step CA URL")
16 step_fingerprint: str = Field(..., description="Step CA Fingerprint")
17 step_provisioner: str = Field(..., description="Step Provisioner Name")
19 step_provisioner_key: SecretStr = Field(default="/run/secrets/stepca_key", description="Path to provisioner key")
20 step_password_file: SecretStr = Field(default="/run/secrets/stepca_password", description="Path to password file")
22 # Logic flags
23 ignore_if_certresolver_present: bool = Field(default=True, description="Ignore routers with existing certresolver")
24 issue_if_tls_true: bool = Field(default=True, description="Only issue if tls=true label is present")
26 model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", case_sensitive=False)
28settings = Settings()