From 3b973a34b42651ea39bc8cdc20491676b353fa78 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Wed, 25 Sep 2024 15:23:38 -0700 Subject: [PATCH 01/11] interop deploy: stub out manifest app --- api-interop-layer/package.json | 4 ++++ manifests/manifest-james.yaml | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/api-interop-layer/package.json b/api-interop-layer/package.json index 8e7145d27..f93e79b7f 100644 --- a/api-interop-layer/package.json +++ b/api-interop-layer/package.json @@ -24,5 +24,9 @@ "chai-as-promised": "^8.0.0", "mocha": "^10.7.3", "sinon": "^18.0.0" + }, + "engines": { + "node": "18.20.4", + "npm": "10.7.0" } } diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index b652c5b38..8c7e5280c 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -34,3 +34,17 @@ applications: ALLOWED_IPS: ((allowed-ips)) SPACE_NAME: james random-route: false + + - name: api-weathergov-james + stack: cflinuxfs4 + memory: 1G + instances: 1 + buildpacks: + - nodejs_buildpack + env: + NEWRELIC_LICENSE: ((newrelic-license)) + health-check-type: process + path: ../api-interop-layer + random-route: false + services: + - database From 9d6f34587534d3e6ac20485aa9c73d05714e8a91 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Wed, 25 Sep 2024 15:41:01 -0700 Subject: [PATCH 02/11] interop deploy: get creds from cloud.gov --- api-interop-layer/data/db.js | 37 ++++++++++++++++++++++++++--------- manifests/manifest-james.yaml | 1 + 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/api-interop-layer/data/db.js b/api-interop-layer/data/db.js index 2c6b0b926..f453fdc6e 100644 --- a/api-interop-layer/data/db.js +++ b/api-interop-layer/data/db.js @@ -2,16 +2,35 @@ import mariadb from "mariadb"; import { sleep } from "../util/sleep.js"; -export const openDatabase = async () => { - const connectionDetails = { - user: process.env.DB_USERNAME ?? "drupal", - password: process.env.DB_PASSWORD ?? "drupal", - database: process.env.DB_NAME ?? "weathergov", - host: process.env.DB_HOST ?? "database", - port: process.env.DB_PORT ?? 3306, - ssl: { rejectUnauthorized: false }, - }; +const getDatabaseConnection = () => { + if (process.env.PRODUCTION) { + // we are in a cloud.gov environment and must retrieve credentials from + // the VCAP_SERVICES environment variable + const vcap = JSON.parse(process.env.VCAP_SERVICES); + const db = vcap["aws-rds"][0]; + return { + user: db.credentials.username, + password: db.credentials.password, + database: db.credentials.name, + host: db.credentials.host, + port: db.credentials.port, + }; + return mariadb.createConnection(connectionDetails); + } else { + // we are in a local environment: offer defaults for ease of use + return { + user: process.env.DB_USERNAME ?? "drupal", + password: process.env.DB_PASSWORD ?? "drupal", + database: process.env.DB_NAME ?? "weathergov", + host: process.env.DB_HOST ?? "database", + port: process.env.DB_PORT ?? 3306, + ssl: { rejectUnauthorized: false }, + }; + } +} +export const openDatabase = async () => { + const connectionDetails = getDatabaseConnection(); return mariadb.createConnection(connectionDetails); }; diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index 8c7e5280c..589af76b3 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -43,6 +43,7 @@ applications: - nodejs_buildpack env: NEWRELIC_LICENSE: ((newrelic-license)) + PRODUCTION: true health-check-type: process path: ../api-interop-layer random-route: false From 29f02c750463b816b2c2d43cff1226798c3ba9a5 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Wed, 25 Sep 2024 15:54:15 -0700 Subject: [PATCH 03/11] interop deploy: add to manifest template --- manifests/manifest.template.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/manifests/manifest.template.yaml b/manifests/manifest.template.yaml index dd6d12731..2e66a2870 100644 --- a/manifests/manifest.template.yaml +++ b/manifests/manifest.template.yaml @@ -34,3 +34,25 @@ applications: ALLOWED_IPS: ((allowed-ips)) SPACE_NAME: ENVIRONMENT random-route: false + +# - name: cronish +# <<: *defaults +# no-route: true +# command: ./cronish.sh +# health-check-type: process +# memory: 128M + + - name: api-weathergov-ENVIRONMENT + stack: cflinuxfs4 + memory: 1G + instances: 1 + buildpacks: + - nodejs_buildpack + env: + NEWRELIC_LICENSE: ((newrelic-license)) + PRODUCTION: true + health-check-type: process + path: ../api-interop-layer + random-route: false + services: + - database From 94f101cf864c8f7e3d55541ce12fdc0277305548 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Thu, 26 Sep 2024 11:49:32 -0700 Subject: [PATCH 04/11] interop deploy: standardize env vars --- api-interop-layer/util/fetch.js | 2 +- docker-compose.test.yml | 4 ++-- docker-compose.yml | 6 +++--- manifests/manifest-design.yaml | 2 +- web/modules/weather_data/src/Service/DataLayer.php | 2 +- web/modules/weather_data/weather_data.module | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api-interop-layer/util/fetch.js b/api-interop-layer/util/fetch.js index 86574c664..3d3ade29b 100644 --- a/api-interop-layer/util/fetch.js +++ b/api-interop-layer/util/fetch.js @@ -3,7 +3,7 @@ import { sleep } from "./sleep.js"; const logger = createLogger("fetch wrapper"); -const BASE_URL = process.env.API_URL ?? "https://api.weather.gov"; +const BASE_URL = process.env.API_PROXY_URL ?? "https://api.weather.gov"; const internalFetch = async (path) => { const url = URL.canParse(path) ? path : new URL(path, BASE_URL).toString(); diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 6416a2860..71481dd63 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -10,8 +10,8 @@ services: - api-proxy-test - api-interop-layer-test environment: # we want to extend, not override - API_URL: http://api-proxy-test:9081 - INTEROP_URL: http://api-interop-layer-test:9082 + API_PROXY_URL: http://api-proxy-test:9081 + API_INTEROP_URL: http://api-interop-layer-test:9082 DRUPAL_DB_HOST: database-test profiles: !override ["test"] diff --git a/docker-compose.yml b/docker-compose.yml index f2b4ea6f5..697b19850 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: DB_PASSWORD: drupal DB_HOST: database DB_PORT: 3306 - API_URL: http://api-proxy:8081 + API_PROXY_URL: http://api-proxy:8081 APP_NAME: ${APP_NAME:-local} NEWRELIC_LICENSE: $NEWRELIC_LICENSE networks: @@ -67,8 +67,8 @@ services: - api-proxy - api-interop-layer environment: - API_URL: http://api-proxy:8081 - INTEROP_URL: http://api-interop-layer:8082 + API_PROXY_URL: http://api-proxy:8081 + API_INTEROP_URL: http://api-interop-layer:8082 DRUPAL_DB_NAME: weathergov DRUPAL_DB_USERNAME: drupal DRUPAL_DB_PASSWORD: drupal diff --git a/manifests/manifest-design.yaml b/manifests/manifest-design.yaml index ae5f64c8e..77502f7a9 100644 --- a/manifests/manifest-design.yaml +++ b/manifests/manifest-design.yaml @@ -9,7 +9,7 @@ default_config: &defaults env: PHP_INI_SCAN_DIR: /home/vcap/app/php/etc/:/home/vcap/app/php/etc/php.ini.d/ NEWRELIC_LICENSE: ((newrelic-license)) - API_URL: https://weathergov-api-proxy.app.cloud.gov + API_PROXY_URL: https://weathergov-api-proxy.app.cloud.gov services: - database - storage diff --git a/web/modules/weather_data/src/Service/DataLayer.php b/web/modules/weather_data/src/Service/DataLayer.php index bc6ed3702..8f36dbe0c 100644 --- a/web/modules/weather_data/src/Service/DataLayer.php +++ b/web/modules/weather_data/src/Service/DataLayer.php @@ -66,7 +66,7 @@ public function __construct( private function fetch($url, $attempt = 1, $delay = 75) { if (!preg_match("/^https?:\/\//", $url)) { - $baseUrl = getEnv("API_URL"); + $baseUrl = getEnv("API_PROXY_URL"); $baseUrl = $baseUrl == false ? "https://api.weather.gov" : $baseUrl; $url = $baseUrl . $url; } diff --git a/web/modules/weather_data/weather_data.module b/web/modules/weather_data/weather_data.module index a7f5ca8fd..48c986a34 100644 --- a/web/modules/weather_data/weather_data.module +++ b/web/modules/weather_data/weather_data.module @@ -12,13 +12,13 @@ function weather_data_template_preprocess_default_variables_alter(&$variables) $lon = $route->getParameter("lon"); $weatherMetadata["point"] = ["lat" => $lat, "lon" => $lon]; - $baseUrl = getEnv("INTEROP_URL"); + // this is required since we no longer can interpret api.weather.gov lat/lon directly + $baseUrl = getEnv("API_INTEROP_URL"); $fetch = $container->get("http_client"); - try { $data = $fetch - ->get("http://api-interop-layer:8082/point/$lat/$lon") + ->get("http://$baseUrl/point/$lat/$lon") ->getBody(); } catch (Throwable $e) { $data = '{"error":true}'; From 5f9dc13d7401c33a0e02bf48281bf04eda1fdc8c Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Thu, 26 Sep 2024 11:54:57 -0700 Subject: [PATCH 05/11] eslint fixes --- api-interop-layer/data/db.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/api-interop-layer/data/db.js b/api-interop-layer/data/db.js index f453fdc6e..5bd1c53a2 100644 --- a/api-interop-layer/data/db.js +++ b/api-interop-layer/data/db.js @@ -15,18 +15,17 @@ const getDatabaseConnection = () => { host: db.credentials.host, port: db.credentials.port, }; - return mariadb.createConnection(connectionDetails); - } else { - // we are in a local environment: offer defaults for ease of use - return { - user: process.env.DB_USERNAME ?? "drupal", - password: process.env.DB_PASSWORD ?? "drupal", - database: process.env.DB_NAME ?? "weathergov", - host: process.env.DB_HOST ?? "database", - port: process.env.DB_PORT ?? 3306, - ssl: { rejectUnauthorized: false }, - }; } + + // we are in a local environment: offer defaults for ease of use + return { + user: process.env.DB_USERNAME ?? "drupal", + password: process.env.DB_PASSWORD ?? "drupal", + database: process.env.DB_NAME ?? "weathergov", + host: process.env.DB_HOST ?? "database", + port: process.env.DB_PORT ?? 3306, + ssl: { rejectUnauthorized: false }, + }; } export const openDatabase = async () => { From 2065dc97b2012535cf177cafe64ab3a0098c5565 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Thu, 26 Sep 2024 12:33:02 -0700 Subject: [PATCH 06/11] add API_INTEROP_URL to manifests --- manifests/manifest-james.yaml | 1 + manifests/manifest.template.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index 589af76b3..a7e2b6b76 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -9,6 +9,7 @@ default_config: &defaults env: PHP_INI_SCAN_DIR: /home/vcap/app/php/etc/:/home/vcap/app/php/etc/php.ini.d/ NEWRELIC_LICENSE: ((newrelic-license)) + API_INTEROP_URL: https://api-weathergov-james.app.cloud.gov/ services: - database - storage diff --git a/manifests/manifest.template.yaml b/manifests/manifest.template.yaml index 2e66a2870..cd892e9ac 100644 --- a/manifests/manifest.template.yaml +++ b/manifests/manifest.template.yaml @@ -9,6 +9,7 @@ default_config: &defaults env: PHP_INI_SCAN_DIR: /home/vcap/app/php/etc/:/home/vcap/app/php/etc/php.ini.d/ NEWRELIC_LICENSE: ((newrelic-license)) + API_INTEROP_URL: https://api-weathergov-ENVIRONMENT.app.cloud.gov/ services: - database - storage From 30d91369c2231c9df6910383d6dec9d94b8e8d50 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Thu, 26 Sep 2024 13:12:25 -0700 Subject: [PATCH 07/11] api interop deploy: baseUrl fixes --- manifests/manifest-james.yaml | 2 +- manifests/manifest.template.yaml | 2 +- web/modules/weather_data/weather_data.module | 3 ++- web/sites/default/settings.cloudgov.php | 5 +++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index a7e2b6b76..d1720a308 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -9,7 +9,7 @@ default_config: &defaults env: PHP_INI_SCAN_DIR: /home/vcap/app/php/etc/:/home/vcap/app/php/etc/php.ini.d/ NEWRELIC_LICENSE: ((newrelic-license)) - API_INTEROP_URL: https://api-weathergov-james.app.cloud.gov/ + API_INTEROP_URL: https://api-weathergov-james.app.cloud.gov services: - database - storage diff --git a/manifests/manifest.template.yaml b/manifests/manifest.template.yaml index cd892e9ac..4617ffc89 100644 --- a/manifests/manifest.template.yaml +++ b/manifests/manifest.template.yaml @@ -9,7 +9,7 @@ default_config: &defaults env: PHP_INI_SCAN_DIR: /home/vcap/app/php/etc/:/home/vcap/app/php/etc/php.ini.d/ NEWRELIC_LICENSE: ((newrelic-license)) - API_INTEROP_URL: https://api-weathergov-ENVIRONMENT.app.cloud.gov/ + API_INTEROP_URL: https://api-weathergov-ENVIRONMENT.app.cloud.gov services: - database - storage diff --git a/web/modules/weather_data/weather_data.module b/web/modules/weather_data/weather_data.module index 48c986a34..93b1cb8ec 100644 --- a/web/modules/weather_data/weather_data.module +++ b/web/modules/weather_data/weather_data.module @@ -13,12 +13,13 @@ function weather_data_template_preprocess_default_variables_alter(&$variables) $weatherMetadata["point"] = ["lat" => $lat, "lon" => $lon]; // this is required since we no longer can interpret api.weather.gov lat/lon directly + // note: the url must have a scheme (https:// or http://) and no trailing slash $baseUrl = getEnv("API_INTEROP_URL"); $fetch = $container->get("http_client"); try { $data = $fetch - ->get("http://$baseUrl/point/$lat/$lon") + ->get("$baseUrl/point/$lat/$lon") ->getBody(); } catch (Throwable $e) { $data = '{"error":true}'; diff --git a/web/sites/default/settings.cloudgov.php b/web/sites/default/settings.cloudgov.php index d4734f0c0..fafbbc562 100755 --- a/web/sites/default/settings.cloudgov.php +++ b/web/sites/default/settings.cloudgov.php @@ -102,6 +102,11 @@ "https://weathergov-eric.app.cloud.gov"; break; + case "james": + $config["samlauth.authentication"]["sp_entity_id"] = + "https://weathergov-james.app.cloud.gov"; + break; + case "staging": $config["samlauth.authentication"]["sp_entity_id"] = "https://weathergov-staging.app.cloud.gov"; From 09df7337fc5d8d21d689624ba6bbdf56da536991 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Thu, 26 Sep 2024 17:41:41 -0700 Subject: [PATCH 08/11] api interop deploy: bump down to 256M --- manifests/manifest-james.yaml | 2 +- manifests/manifest.template.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index d1720a308..58cb77e6b 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -38,7 +38,7 @@ applications: - name: api-weathergov-james stack: cflinuxfs4 - memory: 1G + memory: 256M instances: 1 buildpacks: - nodejs_buildpack diff --git a/manifests/manifest.template.yaml b/manifests/manifest.template.yaml index 4617ffc89..347eecf4f 100644 --- a/manifests/manifest.template.yaml +++ b/manifests/manifest.template.yaml @@ -45,7 +45,7 @@ applications: - name: api-weathergov-ENVIRONMENT stack: cflinuxfs4 - memory: 1G + memory: 256M instances: 1 buildpacks: - nodejs_buildpack From 8d562da60523cd971f6f86de871e52c2ff044dd5 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Mon, 30 Sep 2024 11:16:24 -0700 Subject: [PATCH 09/11] interop deploy: cleanups --- api-interop-layer/data/db.js | 2 +- api-interop-layer/util/fetch.js | 7 ++++++- manifests/manifest-james.yaml | 2 +- manifests/manifest.template.yaml | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api-interop-layer/data/db.js b/api-interop-layer/data/db.js index 5bd1c53a2..e651e0e59 100644 --- a/api-interop-layer/data/db.js +++ b/api-interop-layer/data/db.js @@ -3,7 +3,7 @@ import mariadb from "mariadb"; import { sleep } from "../util/sleep.js"; const getDatabaseConnection = () => { - if (process.env.PRODUCTION) { + if (process.env.API_INTEROP_PRODUCTION) { // we are in a cloud.gov environment and must retrieve credentials from // the VCAP_SERVICES environment variable const vcap = JSON.parse(process.env.VCAP_SERVICES); diff --git a/api-interop-layer/util/fetch.js b/api-interop-layer/util/fetch.js index 3d3ade29b..655bf5b5a 100644 --- a/api-interop-layer/util/fetch.js +++ b/api-interop-layer/util/fetch.js @@ -39,7 +39,12 @@ export const fetchAPIJson = async (path, { wait = sleep } = {}) => .catch(() => wait(204).then(() => internalFetch(path))) .catch(() => wait(337).then(() => internalFetch(path))) .catch((e) => { - logger.error(e.cause); + if (e instanceof SyntaxError) { + // this can happen if the API or proxy returns HTML + logger.error(`error retrieving ${path}: endpoint returned invalid JSON: ${e}`); + } else { + logger.error(`error retrieving ${path}: ${e.cause}`); + } return { ...e.cause, error: true }; }); diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index 58cb77e6b..f3195f6c4 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -44,7 +44,7 @@ applications: - nodejs_buildpack env: NEWRELIC_LICENSE: ((newrelic-license)) - PRODUCTION: true + API_INTEROP_PRODUCTION: true health-check-type: process path: ../api-interop-layer random-route: false diff --git a/manifests/manifest.template.yaml b/manifests/manifest.template.yaml index 347eecf4f..fcb46e24c 100644 --- a/manifests/manifest.template.yaml +++ b/manifests/manifest.template.yaml @@ -51,7 +51,7 @@ applications: - nodejs_buildpack env: NEWRELIC_LICENSE: ((newrelic-license)) - PRODUCTION: true + API_INTEROP_PRODUCTION: true health-check-type: process path: ../api-interop-layer random-route: false From 4741d0e68374a470d4fad782b13cc05a425b556f Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Mon, 30 Sep 2024 15:33:04 -0700 Subject: [PATCH 10/11] interop deploy: set NR app name --- api-interop-layer/newrelic.cjs | 2 +- docker-compose.yml | 2 +- manifests/manifest-james.yaml | 1 + manifests/manifest.template.yaml | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api-interop-layer/newrelic.cjs b/api-interop-layer/newrelic.cjs index c610bafb4..de72616ec 100644 --- a/api-interop-layer/newrelic.cjs +++ b/api-interop-layer/newrelic.cjs @@ -9,7 +9,7 @@ exports.config = { /** * Array of application names. */ - app_name: [`api-interop-${process.env.APP_NAME || 'local'}`], + app_name: [`api-interop-${process.env.API_INTEROP_NAME || 'local'}`], /** * Your New Relic license key. */ diff --git a/docker-compose.yml b/docker-compose.yml index 697b19850..5304c59cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: DB_HOST: database DB_PORT: 3306 API_PROXY_URL: http://api-proxy:8081 - APP_NAME: ${APP_NAME:-local} + API_INTEROP_NAME: ${API_INTEROP_NAME:-local} NEWRELIC_LICENSE: $NEWRELIC_LICENSE networks: - weather.gov diff --git a/manifests/manifest-james.yaml b/manifests/manifest-james.yaml index f3195f6c4..760022fd9 100644 --- a/manifests/manifest-james.yaml +++ b/manifests/manifest-james.yaml @@ -45,6 +45,7 @@ applications: env: NEWRELIC_LICENSE: ((newrelic-license)) API_INTEROP_PRODUCTION: true + API_INTEROP_NAME: james health-check-type: process path: ../api-interop-layer random-route: false diff --git a/manifests/manifest.template.yaml b/manifests/manifest.template.yaml index fcb46e24c..083f68601 100644 --- a/manifests/manifest.template.yaml +++ b/manifests/manifest.template.yaml @@ -52,6 +52,7 @@ applications: env: NEWRELIC_LICENSE: ((newrelic-license)) API_INTEROP_PRODUCTION: true + API_INTEROP_NAME: ENVIRONMENT health-check-type: process path: ../api-interop-layer random-route: false From 916e9ec7b2885ef7ec2f562a84803d2d6dcd79d2 Mon Sep 17 00:00:00 2001 From: James Tranovich Date: Tue, 1 Oct 2024 12:37:17 -0700 Subject: [PATCH 11/11] api interop deploy: go back to API_URL --- api-interop-layer/util/fetch.js | 2 +- docker-compose.test.yml | 2 +- docker-compose.yml | 4 ++-- manifests/manifest-design.yaml | 2 +- web/modules/weather_data/src/Service/DataLayer.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api-interop-layer/util/fetch.js b/api-interop-layer/util/fetch.js index 655bf5b5a..a00fdabe9 100644 --- a/api-interop-layer/util/fetch.js +++ b/api-interop-layer/util/fetch.js @@ -3,7 +3,7 @@ import { sleep } from "./sleep.js"; const logger = createLogger("fetch wrapper"); -const BASE_URL = process.env.API_PROXY_URL ?? "https://api.weather.gov"; +const BASE_URL = process.env.API_URL ?? "https://api.weather.gov"; const internalFetch = async (path) => { const url = URL.canParse(path) ? path : new URL(path, BASE_URL).toString(); diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 71481dd63..4df094fec 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -10,7 +10,7 @@ services: - api-proxy-test - api-interop-layer-test environment: # we want to extend, not override - API_PROXY_URL: http://api-proxy-test:9081 + API_URL: http://api-proxy-test:9081 API_INTEROP_URL: http://api-interop-layer-test:9082 DRUPAL_DB_HOST: database-test profiles: !override ["test"] diff --git a/docker-compose.yml b/docker-compose.yml index 5304c59cb..d7d7b0a63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: DB_PASSWORD: drupal DB_HOST: database DB_PORT: 3306 - API_PROXY_URL: http://api-proxy:8081 + API_URL: http://api-proxy:8081 API_INTEROP_NAME: ${API_INTEROP_NAME:-local} NEWRELIC_LICENSE: $NEWRELIC_LICENSE networks: @@ -67,7 +67,7 @@ services: - api-proxy - api-interop-layer environment: - API_PROXY_URL: http://api-proxy:8081 + API_URL: http://api-proxy:8081 API_INTEROP_URL: http://api-interop-layer:8082 DRUPAL_DB_NAME: weathergov DRUPAL_DB_USERNAME: drupal diff --git a/manifests/manifest-design.yaml b/manifests/manifest-design.yaml index 77502f7a9..ae5f64c8e 100644 --- a/manifests/manifest-design.yaml +++ b/manifests/manifest-design.yaml @@ -9,7 +9,7 @@ default_config: &defaults env: PHP_INI_SCAN_DIR: /home/vcap/app/php/etc/:/home/vcap/app/php/etc/php.ini.d/ NEWRELIC_LICENSE: ((newrelic-license)) - API_PROXY_URL: https://weathergov-api-proxy.app.cloud.gov + API_URL: https://weathergov-api-proxy.app.cloud.gov services: - database - storage diff --git a/web/modules/weather_data/src/Service/DataLayer.php b/web/modules/weather_data/src/Service/DataLayer.php index 8f36dbe0c..bc6ed3702 100644 --- a/web/modules/weather_data/src/Service/DataLayer.php +++ b/web/modules/weather_data/src/Service/DataLayer.php @@ -66,7 +66,7 @@ public function __construct( private function fetch($url, $attempt = 1, $delay = 75) { if (!preg_match("/^https?:\/\//", $url)) { - $baseUrl = getEnv("API_PROXY_URL"); + $baseUrl = getEnv("API_URL"); $baseUrl = $baseUrl == false ? "https://api.weather.gov" : $baseUrl; $url = $baseUrl . $url; }