refactor: make static the default branch in _parse_key_config
test / unit (pull_request) Successful in 29s
test / integration (pull_request) Successful in 16s
lint / lint (push) Successful in 1m31s
test / unit (push) Successful in 28s
test / integration (push) Successful in 15s
Update Quality Badges / update-badges (push) Successful in 1m10s

This commit was merged in pull request #235.
This commit is contained in:
2026-06-19 22:25:14 +00:00
parent f00c567469
commit 7a124d7d25
+16 -16
View File
@@ -195,22 +195,7 @@ def _parse_key_config(
f"allowed: {', '.join(sorted(_KEY_PROVIDERS))}" f"allowed: {', '.join(sorted(_KEY_PROVIDERS))}"
) )
if provider == "static": if provider == "gitea":
for k in d:
if k not in {"provider", "path"}:
raise ManifestError(
f"bottle '{bottle_name}' {label}.key has unknown key {k!r} "
f"for provider 'static'; allowed: provider, path"
)
path = d.get("path")
if not isinstance(path, str) or not path:
raise ManifestError(
f"bottle '{bottle_name}' {label}.key missing required "
f"string field 'path' for provider 'static'"
)
return ManifestKeyConfig(provider=provider, path=path)
# provider == "gitea"
for k in d: for k in d:
if k not in {"provider", "forge_token_env", "api_url"}: if k not in {"provider", "forge_token_env", "api_url"}:
raise ManifestError( raise ManifestError(
@@ -234,6 +219,21 @@ def _parse_key_config(
api_url=api_url_raw, api_url=api_url_raw,
) )
# provider == "static"
for k in d:
if k not in {"provider", "path"}:
raise ManifestError(
f"bottle '{bottle_name}' {label}.key has unknown key {k!r} "
f"for provider 'static'; allowed: provider, path"
)
path = d.get("path")
if not isinstance(path, str) or not path:
raise ManifestError(
f"bottle '{bottle_name}' {label}.key missing required "
f"string field 'path' for provider 'static'"
)
return ManifestKeyConfig(provider=provider, path=path)
@dataclass(frozen=True) @dataclass(frozen=True)
class ManifestGitUser: class ManifestGitUser: