diff --git a/frontend/environment-variables.md b/frontend/environment-variables.md index 1db8c63fd..7825d6326 100644 --- a/frontend/environment-variables.md +++ b/frontend/environment-variables.md @@ -10,6 +10,7 @@ | REACT_APP_VERSION | - | Injected version via `$npm_package_version` in`.env` file to ensure the version is shown in the frontend | | API_HOST | - | IP address of the api. This is only required if nginx proxy is used.
**Hint:** When deployed locally the host is set to localhost | | API_PORT | 8080 | Port of the api. This is only required if nginx proxy is used | +| REACT_APP_EXCHANGE_RATE_URL | `https://data-api.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A?lastNObservations=1` | The external URL where the exchange rates are fetched from | ### Email-Service diff --git a/frontend/src/config.js b/frontend/src/config.js index ca78db26f..a53792ed1 100644 --- a/frontend/src/config.js +++ b/frontend/src/config.js @@ -1,6 +1,7 @@ const config = { envMode: process.env.NODE_ENV || "development", version: process.env.REACT_APP_VERSION || "", + exchangeRateUrl: process.env.REACT_APP_EXCHANGE_RATE_URL || "https://data-api.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A?lastNObservations=1", logging: { isEnabled: process.env.REACT_APP_LOGGING === "true" ? true : false, logLevel: process.env.REACT_APP_LOG_LEVEL || "trace", diff --git a/frontend/src/getExchangeRates.js b/frontend/src/getExchangeRates.js index f9308dd53..d2550851e 100644 --- a/frontend/src/getExchangeRates.js +++ b/frontend/src/getExchangeRates.js @@ -1,5 +1,7 @@ import axios from "axios"; +import config from "./config"; + const getRate = (series) => { // catch non existing series if (!series) return 0; @@ -16,7 +18,7 @@ export async function getExchangeRates(baseCurrency = "EUR") { const instance = axios.create(); delete instance.defaults.headers.common["Authorization"]; const response = await instance.get( - "https://data-api.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A?lastNObservations=1", + config.exchangeRateUrl, { headers: {} } ); const exchangeRates = {};