Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8
context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; }
name:ph… (push) Successful in 40s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 49s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3
context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 1m37s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:linkki-tiedotus oci_labels:… (push) Successful in 36s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:timepoll fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:timepoll oci_labels:org.opencontai… (push) Successful in 42s
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
"""Runtime configuration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Settings:
|
|
task_root: Path
|
|
state_root: Path
|
|
credentials_root: Path
|
|
python_executable: str
|
|
timezone_name: str | None
|
|
allowed_proxy_ips: frozenset[str]
|
|
cancel_grace_seconds: float
|
|
shutdown_grace_seconds: float = 110
|
|
|
|
@property
|
|
def database_path(self) -> Path:
|
|
return self.state_root / "server-maintenance.sqlite3"
|
|
|
|
@classmethod
|
|
def from_environment(cls) -> "Settings":
|
|
allowed_proxy_ips = frozenset(
|
|
value.strip()
|
|
for value in os.environ.get(
|
|
"SERVER_MAINTENANCE_ALLOWED_PROXY_IPS", ""
|
|
).split(",")
|
|
if value.strip()
|
|
)
|
|
return cls(
|
|
task_root=Path(
|
|
os.environ.get("SERVER_MAINTENANCE_TASK_ROOT", "/opt/tasks")
|
|
),
|
|
state_root=Path(
|
|
os.environ.get(
|
|
"SERVER_MAINTENANCE_STATE_ROOT",
|
|
"/var/lib/server-maintenance",
|
|
)
|
|
),
|
|
credentials_root=Path(
|
|
os.environ.get(
|
|
"SERVER_MAINTENANCE_CREDENTIALS_ROOT",
|
|
"/opt/credentials",
|
|
)
|
|
),
|
|
python_executable=os.environ.get(
|
|
"SERVER_MAINTENANCE_PYTHON", sys.executable
|
|
),
|
|
timezone_name=os.environ.get("TZ") or None,
|
|
allowed_proxy_ips=allowed_proxy_ips,
|
|
cancel_grace_seconds=float(
|
|
os.environ.get("SERVER_MAINTENANCE_CANCEL_GRACE_SECONDS", "10")
|
|
),
|
|
shutdown_grace_seconds=float(os.environ.get("SERVER_MAINTENANCE_SHUTDOWN_GRACE_SECONDS", "110")),
|
|
)
|