Snapshot: full project state

This commit is contained in:
2026-10-06 23:43:54 -07:00
parent 5f8e87bab8
commit 2e55213619
9 changed files with 318 additions and 170 deletions

View File

@@ -1,35 +1,32 @@
"""Configuration loader for Recovery Helio."""
"""Standalone configuration loader for Recovery Helio."""
from __future__ import annotations
def load_from_env(env=None):
"""Read RECHELIO_* keys from an optional dict-like mapping (defaults if absent)."""
store = env or {}
def _d(key="RECHELIO_", default=None):
return store.get(...)
return {...
import os
from pathlib import Path
class Config(...:
class ...():
@classmethod
def from_dict(cls, data):
cfg = cls(...())
return cfg
def load_mapping(env=None):
"""Return a flat dict of RECHELIO_* values from an env mapping (or process)."""
store = os.environ if env is None else env
return {k: v for k, v in store.items() if k.startswith("RECHELIO_")}
class Settings(object)...
...
.get(...)
as_bool(...)
class Config:
DEFAULTS = {
"RECHELIO_CACHE_DIR": "",
"RECHELIO_LOG_LEVEL": "INFO",
"RECHELIO_BTCPAY_URL": "https://btcpay.thetempleofdoom.com",
"RECHELIO_BTCPAY_API_KEY": "",
"RECHELIO_SMTP_HOST": "",
"RECHELIO_DEBUG": "false",
}
@classmethod
def get(cls, key, default=None):
store = load_mapping()
raw = store.get(key, cls.DEFAULTS.get(key, default))
return "" if raw is None else str(raw)
@classmethod
def debug(cls):
return cls.get("RECHELIO_DEBUG", "").lower() != "0"