Skip to content

Commit 3a709cd

Browse files
fix: honor explicit GTFS_RT_FEEDS=[] and harden renderer CI job
Address CodeRabbit review on PR #130: - bootstrap.sh: an explicit GTFS_RT_FEEDS='[]' now disables realtime feeds instead of silently falling back to the legacy single-feed env vars. Existing deployments (legacy vars set, GTFS_RT_FEEDS unset) are unaffected; whitespace-only values still fall through. Also corrects the status log to read accurately for any feed count (0, 1, or N). - test.yaml: add least-privilege 'permissions: contents: read' to the renderer job.
1 parent 478592e commit 3a709cd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
renderer:
1111
name: Template renderer tests
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
1315
steps:
1416
- name: Checkout code
1517
uses: actions/checkout@v4

oba/bootstrap.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ FEDERATION_XML_DESTINATION="$CATALINA_HOME/webapps/onebusaway-transit-data-feder
3636
# single-feed vars so already-deployed Dockerfiles keep working.
3737
# Strip whitespace for the guard only, so a blank/whitespace GTFS_RT_FEEDS
3838
# falls through to the legacy/no-feeds path instead of producing invalid JSON.
39+
# Any explicit (non-whitespace) value — including "[]" — takes precedence over
40+
# the legacy vars, so operators can disable realtime feeds with GTFS_RT_FEEDS='[]'
41+
# even when the legacy single-feed vars are still set.
3942
GTFS_RT_FEEDS_TRIMMED="$(printf '%s' "$GTFS_RT_FEEDS" | tr -d '[:space:]')"
40-
if [ -n "$GTFS_RT_FEEDS_TRIMMED" ] && [ "$GTFS_RT_FEEDS_TRIMMED" != "[]" ]; then
41-
echo "GTFS_RT_FEEDS is set. Rendering multiple GTFS-RT feeds."
43+
if [ -n "$GTFS_RT_FEEDS_TRIMMED" ]; then
44+
echo "GTFS_RT_FEEDS is set; using it to configure GTFS-RT feeds."
4245
FEEDS_JSON="$GTFS_RT_FEEDS"
4346
elif [ -n "$TRIP_UPDATES_URL" ] || [ -n "$VEHICLE_POSITIONS_URL" ]; then
4447
echo "Legacy single-feed GTFS-RT env vars are set. Normalizing into one feed."

0 commit comments

Comments
 (0)