feat: release v1.1.0 - clean YAML, wildcard DNS protection, and tag/group/source filtering
Build and Publish Release / Build Packages and Publish (push) Successful in 9s
Build and Publish Release / Build Packages and Publish (push) Successful in 9s
This commit is contained in:
1 parent
5fedc44c6b
commit
598e5d7397
18 files changed
+318
-22
No files matched your search
@@ -13,6 +13,7 @@ class ProxmoxConfig:
|
||||
token_secret: str = ""
|
||||
verify_ssl: bool = False
|
||||
timeout: int = 10
|
||||
resolve_dns: bool = True
|
||||
|
||||
@dataclass
|
||||
class StaticFileConfig:
|
||||
@@ -104,8 +105,36 @@ class ConfigLoader:
|
||||
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
def _load_env_files(cls) -> None:
|
||||
"""Loads environment variables from standard env files if not already set in os.environ."""
|
||||
candidates = [
|
||||
Path("/etc/inventory-collector/env"),
|
||||
Path("~/.config/inventory-collector/env").expanduser(),
|
||||
Path("~/.config/inventory-collector/.env").expanduser(),
|
||||
Path("./.env")
|
||||
]
|
||||
for path in candidates:
|
||||
if path.is_file():
|
||||
try:
|
||||
for line in path.read_text(encoding="utf-8").splitlines():
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
if line.startswith("export "):
|
||||
line = line[7:].strip()
|
||||
if "=" in line:
|
||||
k, v = line.split("=", 1)
|
||||
k = k.strip()
|
||||
v = v.strip().strip("'\"")
|
||||
if k and k not in os.environ:
|
||||
os.environ[k] = v
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def load(cls, config_path: Optional[Path] = None) -> AppConfig:
|
||||
cls._load_env_files()
|
||||
config = AppConfig()
|
||||
|
||||
candidates: List[Path] = []
|
||||
@@ -148,7 +177,8 @@ class ConfigLoader:
|
||||
token_id=str(pve_data.get("token_id", "")),
|
||||
token_secret=str(pve_data.get("token_secret", "")),
|
||||
verify_ssl=bool(pve_data.get("verify_ssl", False)),
|
||||
timeout=int(pve_data.get("timeout", 10))
|
||||
timeout=int(pve_data.get("timeout", 10)),
|
||||
resolve_dns=bool(pve_data.get("resolve_dns", True))
|
||||
)
|
||||
|
||||
# Parse sources.static_files
|
||||
|
||||
Reference in new issue
Block a user