From 2fbcc20e499c3636a4d2ef2f8b8bb8c50494efd0 Mon Sep 17 00:00:00 2001 From: sloane Date: Fri, 30 Aug 2024 16:19:38 -0400 Subject: [PATCH] fix: always use API_V3_URL environment variable 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 https://github.com/mbta/devops/pull/2122 --- config/runtime.exs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index 78c2d36fb..7cdd1ac7f 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -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