Crea servizio watchdog configurabile

This commit is contained in:
2026-06-30 20:28:02 +02:00
parent 124cc370e5
commit 4dca5fbf95
17 changed files with 904 additions and 0 deletions

26
src/bakrest/paths.py Normal file
View File

@@ -0,0 +1,26 @@
from __future__ import annotations
import os
from pathlib import Path
APP_DIR_NAME = "BakRest"
CONFIG_ENV_VAR = "BAKREST_CONFIG"
def program_data_dir() -> Path:
base = os.environ.get("PROGRAMDATA")
if base:
return Path(base) / APP_DIR_NAME
return Path.home() / f".{APP_DIR_NAME.lower()}"
def default_config_path() -> Path:
configured = os.environ.get(CONFIG_ENV_VAR)
if configured:
return Path(configured).expanduser()
return program_data_dir() / "config.toml"
def expand_path(value: str) -> Path:
return Path(os.path.expandvars(value)).expanduser()