fix(admin,api): honor STORAGE_IMPL when surfacing file_store backend (closes #17294) (#17441)

## Summary

When `STORAGE_IMPL=AWS_S3`, the Admin Service status page keeps showing
MinIO. Three things conspire:

1. `admin/server/config.py::load_configurations` only knows the
   `minio` and `minio_0` config keys. An `s3` block lands on the
   `case _:` branch and logs `Unknown configuration key: s3`
   (issue #17294).
2. `admin/server/services.py::ServiceMgr.get_all_services` filters
   retrieval services by `DOC_ENGINE` but has no equivalent filter
   for `file_store` services by `STORAGE_IMPL`. A stale MinIO block
   is returned regardless of the active backend.
3. The wired health check is hardcoded to `check_minio_alive`, which
   calls `settings.MINIO['host']`. With `STORAGE_IMPL=AWS_S3` that
   block is uninitialized, so the check always times out.


Fixes #17294
This commit is contained in:
Harsh Kashyap
2026-07-29 08:43:20 +05:30
committed by GitHub
parent ee388b0fa5
commit 404a5cc33b
7 changed files with 612 additions and 0 deletions

View File

@@ -285,6 +285,50 @@ def load_configurations(config_path: str) -> list[BaseConfig]:
config = MinioConfig(id=id_count, name=name, host=host, port=port, user=user, password=password, service_type="file_store", store_type="minio", detail_func_name="check_minio_alive")
configurations.append(config)
id_count += 1
case "s3":
# AWS S3 (or any S3-compatible service: MinIO, R2, ...).
# The config block uses `endpoint_url` instead of `host:port`,
# so parse the URL to derive host/port for the status page.
name: str = "s3"
endpoint_url = v.get("endpoint_url") or ""
if endpoint_url:
try:
parsed = urlparse(endpoint_url)
# `parsed.port` raises ValueError on non-numeric or
# out-of-range ports; `urlparse` itself raises
# ValueError on malformed IPv6 URLs. Fall back to
# the raw endpoint as host and the scheme's
# default port so config loading completes.
host: str = parsed.hostname or endpoint_url
port: int = parsed.port or (443 if parsed.scheme == "https" else 80)
logging.debug(
"Selected S3 host=%s port=%d for endpoint %r.",
host,
port,
endpoint_url,
)
except ValueError:
logging.warning(
"Could not parse S3 endpoint_url %r; using raw value as host with default port.",
endpoint_url,
)
host = endpoint_url
port = 443 if endpoint_url.startswith("https://") else 80
else:
host: str = "s3.amazonaws.com"
port: int = 443
logging.debug("No S3 endpoint_url configured; defaulting to AWS S3 at %s:%d.", host, port)
config = FileStoreConfig(
id=id_count,
name=name,
host=host,
port=port,
service_type="file_store",
store_type="s3",
detail_func_name="check_s3_alive",
)
configurations.append(config)
id_count += 1
case "redis":
name: str = "redis"
url = v["host"]