OneBusAway / onebusaway-docker

Docker configuration for the OneBusAway Application Modules (https://github.com/OneBusAway/onebusaway-application-modules)
Apache License 2.0
18 stars 32 forks source link

feat: ensuring the script is idempotent #86

Closed Altonhe closed 4 months ago

Altonhe commented 4 months ago

The previous script does not ensure idempotent, for example, when you restart the container, it will check if TRIP_UPDATES_URL has been set, and insert the value into the data-source.xml, this will cause duplicate values, like this:

  <bean id="gtfsRT" class="org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource">
    <property name="tripUpdatesUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_TripUpdates.pb"/>
    <property name="vehiclePositionsUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_VehiclePositions.pb"/>
    <property name="alertsUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_ServiceAlerts.pb"/>
    <property name="refreshInterval" value="30"/>
    <property name="agencyId" value="Burlington"/>
     <property name="tripUpdatesUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_TripUpdates.pb"/>
    <property name="vehiclePositionsUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_VehiclePositions.pb"/>
    <property name="alertsUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_ServiceAlerts.pb"/>
    <property name="refreshInterval" value="30"/>
    <property name="agencyId" value="Burlington"/>
     <property name="tripUpdatesUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_TripUpdates.pb"/>
    <property name="vehiclePositionsUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_VehiclePositions.pb"/>
    <property name="alertsUrl" value="https://opendata.burlington.ca/gtfs-rt/GTFS_ServiceAlerts.pb"/>
    <property name="refreshInterval" value="30"/>
    <property name="agencyId" value="Burlington"/>
  </bean>

this PR will ensure each config file will be the same no matter how many times the script is executed.

aaronbrethorst commented 4 months ago

oops, just noticed this is still a draft. let me know when it's ready for review!

Altonhe commented 4 months ago

@aaronbrethorst I forgot to add the description of the PR, I will merge it if you don't mind

aaronbrethorst commented 4 months ago

Sure go for it!