Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/harmonize env variables of various api keys (#2980)
Thomas Kaulf83e75df44f0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d4c425af69..8b2c8d7d77 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Changed++- Harmonized the environment variables of various API keys++### Todo++- Rename the environment variable from `ALPHA_VANTAGE_API_KEY` to `API_KEY_ALPHA_VANTAGE`+- Rename the environment variable from `BETTER_UPTIME_API_KEY` to `API_KEY_BETTER_UPTIME`+- Rename the environment variable from `EOD_HISTORICAL_DATA_API_KEY` to `API_KEY_EOD_HISTORICAL_DATA`+- Rename the environment variable from `FINANCIAL_MODELING_PREP_API_KEY` to `API_KEY_FINANCIAL_MODELING_PREP`+- Rename the environment variable from `OPEN_FIGI_API_KEY` to `API_KEY_OPEN_FIGI`+- Rename the environment variable from `RAPID_API_API_KEY` to `API_KEY_RAPID_API`+## 2.49.0 - 2024-02-09### Addeddiff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.tsindex cf28d9d547..b2481efe61 100644--- a/apps/api/src/app/info/info.service.ts+++ b/apps/api/src/app/info/info.service.ts@@ -351,7 +351,7 @@ export class InfoService {{headers: {Authorization: `Bearer ${this.configurationService.get(- 'BETTER_UPTIME_API_KEY'+ 'API_KEY_BETTER_UPTIME')}`},// @ts-ignorediff --git a/apps/api/src/services/configuration/configuration.service.ts b/apps/api/src/services/configuration/configuration.service.tsindex c9cf8625c2..02d3de498d 100644--- a/apps/api/src/services/configuration/configuration.service.ts+++ b/apps/api/src/services/configuration/configuration.service.ts@@ -11,10 +11,14 @@ export class ConfigurationService {public constructor() {this.environmentConfiguration = cleanEnv(process.env, {ACCESS_TOKEN_SALT: str(),- ALPHA_VANTAGE_API_KEY: str({ default: '' }),+ API_KEY_ALPHA_VANTAGE: str({ default: '' }),+ API_KEY_BETTER_UPTIME: str({ default: '' }),API_KEY_COINGECKO_DEMO: str({ default: '' }),API_KEY_COINGECKO_PRO: str({ default: '' }),- BETTER_UPTIME_API_KEY: str({ default: '' }),+ API_KEY_EOD_HISTORICAL_DATA: str({ default: '' }),+ API_KEY_FINANCIAL_MODELING_PREP: str({ default: '' }),+ API_KEY_OPEN_FIGI: str({ default: '' }),+ API_KEY_RAPID_API: str({ default: '' }),CACHE_QUOTES_TTL: num({ default: 1 }),CACHE_TTL: num({ default: 1 }),DATA_SOURCE_EXCHANGE_RATES: str({ default: DataSource.YAHOO }),@@ -29,8 +33,6 @@ export class ConfigurationService {ENABLE_FEATURE_STATISTICS: bool({ default: false }),ENABLE_FEATURE_SUBSCRIPTION: bool({ default: false }),ENABLE_FEATURE_SYSTEM_MESSAGE: bool({ default: false }),- EOD_HISTORICAL_DATA_API_KEY: str({ default: '' }),- FINANCIAL_MODELING_PREP_API_KEY: str({ default: '' }),GOOGLE_CLIENT_ID: str({ default: 'dummyClientId' }),GOOGLE_SECRET: str({ default: 'dummySecret' }),GOOGLE_SHEETS_ACCOUNT: str({ default: '' }),@@ -40,9 +42,7 @@ export class ConfigurationService {JWT_SECRET_KEY: str({}),MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }),MAX_ITEM_IN_CACHE: num({ default: 9999 }),- OPEN_FIGI_API_KEY: str({ default: '' }),PORT: port({ default: 3333 }),- RAPID_API_API_KEY: str({ default: '' }),REDIS_HOST: str({ default: 'localhost' }),REDIS_PASSWORD: str({ default: '' }),REDIS_PORT: port({ default: 6379 }),diff --git a/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts b/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.tsindex 6ab7901596..b0e06866ab 100644--- a/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts+++ b/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts@@ -28,12 +28,12 @@ export class AlphaVantageService implements DataProviderInterface {private readonly configurationService: ConfigurationService) {this.alphaVantage = Alphavantage({- key: this.configurationService.get('ALPHA_VANTAGE_API_KEY')+ key: this.configurationService.get('API_KEY_ALPHA_VANTAGE')});}public canHandle(symbol: string) {- return !!this.configurationService.get('ALPHA_VANTAGE_API_KEY');+ return !!this.configurationService.get('API_KEY_ALPHA_VANTAGE');}public async getAssetProfile(diff --git a/apps/api/src/services/data-provider/data-enhancer/openfigi/openfigi.service.ts b/apps/api/src/services/data-provider/data-enhancer/openfigi/openfigi.service.tsindex 5e4f01c22b..2224d9b789 100644--- a/apps/api/src/services/data-provider/data-enhancer/openfigi/openfigi.service.ts+++ b/apps/api/src/services/data-provider/data-enhancer/openfigi/openfigi.service.ts@@ -37,9 +37,9 @@ export class OpenFigiDataEnhancerService implements DataEnhancerInterface {dataSource: response.dataSource});- if (this.configurationService.get('OPEN_FIGI_API_KEY')) {+ if (this.configurationService.get('API_KEY_OPEN_FIGI')) {headers['X-OPENFIGI-APIKEY'] =- this.configurationService.get('OPEN_FIGI_API_KEY');+ this.configurationService.get('API_KEY_OPEN_FIGI');}let abortController = new AbortController();diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.tsindex c46055999f..a1b1e8d973 100644--- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts+++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts@@ -36,7 +36,7 @@ export class EodHistoricalDataService implements DataProviderInterface {public constructor(private readonly configurationService: ConfigurationService) {- this.apiKey = this.configurationService.get('EOD_HISTORICAL_DATA_API_KEY');+ this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA');}public canHandle(symbol: string) {diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.tsindex fe1b18cc15..cbea38aec2 100644--- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts+++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts@@ -28,7 +28,7 @@ export class FinancialModelingPrepService implements DataProviderInterface {private readonly configurationService: ConfigurationService) {this.apiKey = this.configurationService.get(- 'FINANCIAL_MODELING_PREP_API_KEY'+ 'API_KEY_FINANCIAL_MODELING_PREP');}diff --git a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.tsindex 31c813180a..f684a4631a 100644--- a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts+++ b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts@@ -26,7 +26,7 @@ export class RapidApiService implements DataProviderInterface {) {}public canHandle(symbol: string) {- return !!this.configurationService.get('RAPID_API_API_KEY');+ return !!this.configurationService.get('API_KEY_RAPID_API');}public async getAssetProfile(@@ -140,7 +140,7 @@ export class RapidApiService implements DataProviderInterface {headers: {useQueryString: 'true','x-rapidapi-host': 'fear-and-greed-index.p.rapidapi.com',- 'x-rapidapi-key': this.configurationService.get('RAPID_API_API_KEY')+ 'x-rapidapi-key': this.configurationService.get('API_KEY_RAPID_API')},// @ts-ignoresignal: abortController.signaldiff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.tsindex c4baee3bf6..d380b31a7d 100644--- a/apps/api/src/services/interfaces/environment.interface.ts+++ b/apps/api/src/services/interfaces/environment.interface.ts@@ -2,10 +2,14 @@ import { CleanedEnvAccessors } from 'envalid';export interface Environment extends CleanedEnvAccessors {ACCESS_TOKEN_SALT: string;- ALPHA_VANTAGE_API_KEY: string;+ API_KEY_ALPHA_VANTAGE: string;+ API_KEY_BETTER_UPTIME: string;API_KEY_COINGECKO_DEMO: string;API_KEY_COINGECKO_PRO: string;- BETTER_UPTIME_API_KEY: string;+ API_KEY_EOD_HISTORICAL_DATA: string;+ API_KEY_FINANCIAL_MODELING_PREP: string;+ API_KEY_OPEN_FIGI: string;+ API_KEY_RAPID_API: string;CACHE_QUOTES_TTL: number;CACHE_TTL: number;DATA_SOURCE_EXCHANGE_RATES: string;@@ -18,8 +22,6 @@ export interface Environment extends CleanedEnvAccessors {ENABLE_FEATURE_STATISTICS: boolean;ENABLE_FEATURE_SUBSCRIPTION: boolean;ENABLE_FEATURE_SYSTEM_MESSAGE: boolean;- EOD_HISTORICAL_DATA_API_KEY: string;- FINANCIAL_MODELING_PREP_API_KEY: string;GOOGLE_CLIENT_ID: string;GOOGLE_SECRET: string;GOOGLE_SHEETS_ACCOUNT: string;@@ -28,9 +30,7 @@ export interface Environment extends CleanedEnvAccessors {JWT_SECRET_KEY: string;MAX_ACTIVITIES_TO_IMPORT: number;MAX_ITEM_IN_CACHE: number;- OPEN_FIGI_API_KEY: string;PORT: number;- RAPID_API_API_KEY: string;REDIS_HOST: string;REDIS_PASSWORD: string;REDIS_PORT: number;