fix(config): correct OIDC token-type/scopes env keys; address review round 1
- _DEFAULTS keys for NEXTCLOUD_OIDC_TOKEN_TYPE / NEXTCLOUD_OIDC_SCOPES were registered as oidc_* (uppercasing to OIDC_*), so dynaconf (ignore_unknown_envvars) never read the NEXTCLOUD_-prefixed env vars and the fields stayed at their defaults. Prefix the keys to match _field_map; add a regression test. - Add gte=1 validator for HEALTH_READY_REFRESH_INTERVAL and a 1..65535 range validator for PORT. - Tie ReadinessCache.ttl_seconds to 2x the configured refresh interval so is_stale() stays meaningful when the interval is tuned. - Raise the refresh-loop exception log from DEBUG to WARNING. - Make health_ready a sync handler (no awaits); dedupe the localhost fallback into _DEFAULT_MCP_SERVER_URL; use pytest.approx for the float default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
6ef7786cec
commit
cc2ce6e853
@@ -95,6 +95,26 @@ class TestGetSettings:
|
||||
assert settings.qdrant_api_key == "test-key"
|
||||
assert settings.qdrant_location is None
|
||||
|
||||
@patch.dict(
|
||||
os.environ,
|
||||
{
|
||||
"NEXTCLOUD_OIDC_TOKEN_TYPE": "jwt",
|
||||
"NEXTCLOUD_OIDC_SCOPES": "openid profile",
|
||||
},
|
||||
clear=True,
|
||||
)
|
||||
def test_get_settings_oidc_token_type_and_scopes_from_env(self):
|
||||
"""NEXTCLOUD_OIDC_TOKEN_TYPE / _SCOPES must reach settings (regression).
|
||||
|
||||
The settings migration first registered these under _DEFAULTS keys that
|
||||
uppercased to OIDC_* instead of NEXTCLOUD_OIDC_*, so dynaconf silently
|
||||
ignored the env vars and always returned the defaults.
|
||||
"""
|
||||
_reload_config()
|
||||
settings = get_settings()
|
||||
assert settings.oidc_token_type == "jwt"
|
||||
assert settings.oidc_scopes == "openid profile"
|
||||
|
||||
@patch.dict(
|
||||
os.environ,
|
||||
{"QDRANT_LOCATION": "/app/data/qdrant"},
|
||||
|
||||
@@ -18,7 +18,7 @@ def test_dependency_status_defaults():
|
||||
status = DependencyStatus(name="nextcloud")
|
||||
assert status.healthy is None # not yet checked
|
||||
assert status.detail == "pending"
|
||||
assert status.checked_at == 0.0
|
||||
assert status.checked_at == pytest.approx(0.0)
|
||||
|
||||
|
||||
def test_update_and_snapshot_round_trip():
|
||||
|
||||
Reference in New Issue
Block a user