feat(elicitation): add is_configured() and apply_runtime_config() to settings

This commit is contained in:
Jacob Magar
2026-03-14 03:43:20 -04:00
parent 1952720ef9
commit 520d92af57
2 changed files with 53 additions and 0 deletions

View File

@@ -108,6 +108,24 @@ def validate_required_config() -> tuple[bool, list[str]]:
return len(missing) == 0, missing
def is_configured() -> bool:
"""Return True if both required credentials are present."""
return bool(UNRAID_API_URL and UNRAID_API_KEY)
def apply_runtime_config(api_url: str, api_key: str) -> None:
"""Update module-level credential globals at runtime (post-elicitation).
Also sets matching environment variables so submodules that read
os.getenv() after import see the new values.
"""
global UNRAID_API_URL, UNRAID_API_KEY
UNRAID_API_URL = api_url
UNRAID_API_KEY = api_key
os.environ["UNRAID_API_URL"] = api_url
os.environ["UNRAID_API_KEY"] = api_key
def get_config_summary() -> dict[str, Any]:
"""Get a summary of current configuration (safe for logging).