fix: serve legacy route aliases during cutover
This commit is contained in:
parent
8ab1d0c09a
commit
14befd0b50
4 changed files with 57 additions and 2 deletions
|
|
@ -69,11 +69,24 @@ class RuntimeSettings:
|
|||
|
||||
def readiness_checks(self, store_backend: str) -> dict[str, str]:
|
||||
ephemeral_allowed = store_backend != "memory" or self.allow_ephemeral
|
||||
protected_groups = self.v2_groups & {
|
||||
"registry",
|
||||
"credentials",
|
||||
"interaction",
|
||||
"deferred",
|
||||
"operator",
|
||||
}
|
||||
authorization_ready = (
|
||||
not protected_groups
|
||||
or bool(self.api_token)
|
||||
or store_backend == "postgresql"
|
||||
)
|
||||
return {
|
||||
"environment": self.environment,
|
||||
"configured_backend": self.backend,
|
||||
"active_backend": store_backend,
|
||||
"ephemeral_backend": "allowed" if ephemeral_allowed else "not_allowed",
|
||||
"authorization": "ok" if authorization_ready else "unavailable",
|
||||
"contract": "helixforge.hub-extension/0.1.0",
|
||||
"v2_groups": ",".join(sorted(self.v2_groups)) or "none",
|
||||
"v2_write_groups": ",".join(sorted(self.v2_write_groups)) or "none",
|
||||
|
|
@ -81,6 +94,9 @@ class RuntimeSettings:
|
|||
}
|
||||
|
||||
def is_ready(self, store_backend: str) -> bool:
|
||||
return self.backend == store_backend and (
|
||||
store_backend != "memory" or self.allow_ephemeral
|
||||
checks = self.readiness_checks(store_backend)
|
||||
return (
|
||||
self.backend == store_backend
|
||||
and (store_backend != "memory" or self.allow_ephemeral)
|
||||
and checks["authorization"] == "ok"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue