Skip to content

Commit

Permalink
fix: always use API_V3_URL environment variable (#2178)
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 authored Aug 30, 2024
1 parent b8da96a commit 68c98b8
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@
# remember to add this file to your .gitignore.
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", "https://api-v3.mbta.com/"),
api_v3_key: System.get_env("API_V3_KEY")
end

if config_env() == :prod do
eb_env_name = System.get_env("ENVIRONMENT_NAME")

config :sentry,
dsn: System.get_env("SENTRY_DSN"),
environment_name: eb_env_name
Expand Down

0 comments on commit 68c98b8

Please sign in to comment.