mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 18:18:08 +00:00
fix: refuse a Redis URL whose port cannot be used
urlsplit accepts an authority such as localhost:notaport or localhost:65536 and urlunsplit rebuilds it verbatim; only parts.port raises, and nothing read it. The unusable value reached .env, where the worker picked it up and failed to start its broker, while `up` reported success because it waits only on the API health endpoint.
This commit is contained in:
1 parent
147bb352ec
commit
51b2fa38de
2 files changed
+16
No files matched your search
@@ -215,6 +215,13 @@ def _redis_urls(base: str) -> dict[str, str]:
|
||||
except ValueError as exc:
|
||||
# urlsplit raises on things like redis://[::1 ; that is a typo, not a crash.
|
||||
raise DeployError(f"the Redis URL {base!r} could not be read: {exc}") from exc
|
||||
try:
|
||||
_ = parts.port # a non-numeric or out-of-range port raises here, not when the URL is split
|
||||
except ValueError as exc:
|
||||
raise DeployError(
|
||||
f"the Redis URL {base!r} has an unusable port: {exc}. Pass a URL like "
|
||||
"redis://host:6379 or redis://host:6379/5."
|
||||
) from exc
|
||||
if parts.scheme not in ("redis", "rediss"):
|
||||
raise DeployError(
|
||||
f"the Redis URL {base!r} should start with redis:// or rediss://, with any options as "
|
||||
|
||||
Reference in new issue
Block a user