Repository navigation
feat: per-feed config endpoints in the Operations API - #1890
Conversation
ianktc
left a comment
There was a problem hiding this comment.
lgtm. Tested the following requests on local:
GET /v1/operations/config/keys which returns the two schemas feed_download and parquet_builder (this is for Garage i think...?)
GET /v1/operations/gtfs_feeds/{id}/download_headers which shows "source": "built_in" and the default "built_in_headers"
PUT /v1/operations/feeds/{id}/config/{namespace}/{key} on a feed with example payload changing the User Agent Header: "User-Agent":"curl/8.0"
GET /v1/operations/gtfs_feeds/{id}/download_headers to confirm that the source changed to override and the headers: {"User-Agent":"curl/8.0"}
PUT /v1/operations/feeds/{id}/config/{namespace}/{key} with payload {"value":{"Authorization":"Bearer x"}} to confirm response 422
DELETE /v1/operations/feeds/{id}/config/{namespace}/{key} to confirm response 204.
GET /v1/operations/gtfs_feeds/{id}/download_headers to confirm that "source": "built_in" once again and the default "built_in_headers"
Summary:
Adds Operations API endpoints to read and set per-feed config overrides for any registered
config_key, so per-feed settings no longer need hotfix Liquibase PRs (e.g. #1889). Also adds an endpoint that shows the headers the nightly download sends for a GTFS feed. Creating, editing or deleting keys themselves is out of scope.Expected behavior:
GET /v1/operations/config/keyslists the registered keys.GET /v1/operations/feeds/{id}/configreturns, for each key, the default, the override, the value in effect and where it comes from.PUT /v1/operations/feeds/{id}/config/{namespace}/{key}creates (201) or replaces (200) an override.DELETEon the same path removes it (204). An unknown feed or key returns 404, an invalid value 422, and a staleexpected_updated_at409.config_value_schemas.py).feed_download/http_headersrefuses credential headers.GET /v1/operations/gtfs_feeds/{id}/download_headersreturns the headers the download sends today, where they come from (override/config_default/built_in), the built-in headers, and the name of the API key header (never its value). It uses the same helper as the download, and download behavior is unchanged.config_value_feed.updated_by, which records who made the change.Testing tips:
Run
./scripts/api-tests.sh --folder functions-python/operations_api. For a GTFS feed, call GET ondownload_headers, then PUT anhttp_headersoverride and call GET ondownload_headersagain to see the override reported. Then DELETE the override to return the feed to its previous headers../scripts/api-tests.shto make sure you didn't break anythingGenerated with Claude Code