Skip to content

Commit

Permalink
fix: always use API_V3_URL environment variable
Browse files Browse the repository at this point in the history
Our ECS tasks all set a `API_V3_URL` pointing to the desired V3 API
environment but we were ignoring that value and instead deriving the V3
API URL based on `ENVIRONMENT_NAME`. This is confusing.

With this change the URL used for the V3 API is always fetched from the
environment as `API_V3_URL` (unless `MIX_ENV=test`).

This has the added benefit of picking up the changes in mbta/devops#2122
  • Loading branch information
sloanelybutsurely committed Aug 30, 2024
1 parent c7d9904 commit 2fbcc20
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@ import Config

eb_env_name = System.get_env("ENVIRONMENT_NAME")

api_v3_url =
case eb_env_name do
"screens-prod" -> "https://api-v3.mbta.com/"
"screens-dev" -> "https://api-dev.mbtace.com/"
"screens-dev-green" -> "https://api-dev-green.mbtace.com/"
_ -> System.get_env("API_V3_URL", "https://api-v3.mbta.com/")
end

unless config_env() == :test do
config :screens,
api_v3_url: api_v3_url,
api_v3_url: System.get_env("API_V3_URL") || raise("Must set API_V3_URL"),
api_v3_key: System.get_env("API_V3_KEY")
end

Expand Down

0 comments on commit 2fbcc20

Please sign in to comment.