Feature/harmonize env variables of various api keys (#2980)
* Harmonize env variables of various API keys * Update changelog
This commit is contained in:
parent
00a2b60eb5
commit
f83e75df44
15
CHANGELOG.md
15
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/),
|
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).
|
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
|
## 2.49.0 - 2024-02-09
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -351,7 +351,7 @@ export class InfoService {
|
|||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${this.configurationService.get(
|
Authorization: `Bearer ${this.configurationService.get(
|
||||||
'BETTER_UPTIME_API_KEY'
|
'API_KEY_BETTER_UPTIME'
|
||||||
)}`
|
)}`
|
||||||
},
|
},
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -11,10 +11,14 @@ export class ConfigurationService {
|
|||||||
public constructor() {
|
public constructor() {
|
||||||
this.environmentConfiguration = cleanEnv(process.env, {
|
this.environmentConfiguration = cleanEnv(process.env, {
|
||||||
ACCESS_TOKEN_SALT: str(),
|
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_DEMO: str({ default: '' }),
|
||||||
API_KEY_COINGECKO_PRO: 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_QUOTES_TTL: num({ default: 1 }),
|
||||||
CACHE_TTL: num({ default: 1 }),
|
CACHE_TTL: num({ default: 1 }),
|
||||||
DATA_SOURCE_EXCHANGE_RATES: str({ default: DataSource.YAHOO }),
|
DATA_SOURCE_EXCHANGE_RATES: str({ default: DataSource.YAHOO }),
|
||||||
@ -29,8 +33,6 @@ export class ConfigurationService {
|
|||||||
ENABLE_FEATURE_STATISTICS: bool({ default: false }),
|
ENABLE_FEATURE_STATISTICS: bool({ default: false }),
|
||||||
ENABLE_FEATURE_SUBSCRIPTION: bool({ default: false }),
|
ENABLE_FEATURE_SUBSCRIPTION: bool({ default: false }),
|
||||||
ENABLE_FEATURE_SYSTEM_MESSAGE: 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_CLIENT_ID: str({ default: 'dummyClientId' }),
|
||||||
GOOGLE_SECRET: str({ default: 'dummySecret' }),
|
GOOGLE_SECRET: str({ default: 'dummySecret' }),
|
||||||
GOOGLE_SHEETS_ACCOUNT: str({ default: '' }),
|
GOOGLE_SHEETS_ACCOUNT: str({ default: '' }),
|
||||||
@ -40,9 +42,7 @@ export class ConfigurationService {
|
|||||||
JWT_SECRET_KEY: str({}),
|
JWT_SECRET_KEY: str({}),
|
||||||
MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }),
|
MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }),
|
||||||
MAX_ITEM_IN_CACHE: num({ default: 9999 }),
|
MAX_ITEM_IN_CACHE: num({ default: 9999 }),
|
||||||
OPEN_FIGI_API_KEY: str({ default: '' }),
|
|
||||||
PORT: port({ default: 3333 }),
|
PORT: port({ default: 3333 }),
|
||||||
RAPID_API_API_KEY: str({ default: '' }),
|
|
||||||
REDIS_HOST: str({ default: 'localhost' }),
|
REDIS_HOST: str({ default: 'localhost' }),
|
||||||
REDIS_PASSWORD: str({ default: '' }),
|
REDIS_PASSWORD: str({ default: '' }),
|
||||||
REDIS_PORT: port({ default: 6379 }),
|
REDIS_PORT: port({ default: 6379 }),
|
||||||
|
@ -28,12 +28,12 @@ export class AlphaVantageService implements DataProviderInterface {
|
|||||||
private readonly configurationService: ConfigurationService
|
private readonly configurationService: ConfigurationService
|
||||||
) {
|
) {
|
||||||
this.alphaVantage = Alphavantage({
|
this.alphaVantage = Alphavantage({
|
||||||
key: this.configurationService.get('ALPHA_VANTAGE_API_KEY')
|
key: this.configurationService.get('API_KEY_ALPHA_VANTAGE')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public canHandle(symbol: string) {
|
public canHandle(symbol: string) {
|
||||||
return !!this.configurationService.get('ALPHA_VANTAGE_API_KEY');
|
return !!this.configurationService.get('API_KEY_ALPHA_VANTAGE');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getAssetProfile(
|
public async getAssetProfile(
|
||||||
|
@ -37,9 +37,9 @@ export class OpenFigiDataEnhancerService implements DataEnhancerInterface {
|
|||||||
dataSource: response.dataSource
|
dataSource: response.dataSource
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.configurationService.get('OPEN_FIGI_API_KEY')) {
|
if (this.configurationService.get('API_KEY_OPEN_FIGI')) {
|
||||||
headers['X-OPENFIGI-APIKEY'] =
|
headers['X-OPENFIGI-APIKEY'] =
|
||||||
this.configurationService.get('OPEN_FIGI_API_KEY');
|
this.configurationService.get('API_KEY_OPEN_FIGI');
|
||||||
}
|
}
|
||||||
|
|
||||||
let abortController = new AbortController();
|
let abortController = new AbortController();
|
||||||
|
@ -36,7 +36,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
|||||||
public constructor(
|
public constructor(
|
||||||
private readonly configurationService: ConfigurationService
|
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) {
|
public canHandle(symbol: string) {
|
||||||
|
@ -28,7 +28,7 @@ export class FinancialModelingPrepService implements DataProviderInterface {
|
|||||||
private readonly configurationService: ConfigurationService
|
private readonly configurationService: ConfigurationService
|
||||||
) {
|
) {
|
||||||
this.apiKey = this.configurationService.get(
|
this.apiKey = this.configurationService.get(
|
||||||
'FINANCIAL_MODELING_PREP_API_KEY'
|
'API_KEY_FINANCIAL_MODELING_PREP'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export class RapidApiService implements DataProviderInterface {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
public canHandle(symbol: string) {
|
public canHandle(symbol: string) {
|
||||||
return !!this.configurationService.get('RAPID_API_API_KEY');
|
return !!this.configurationService.get('API_KEY_RAPID_API');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getAssetProfile(
|
public async getAssetProfile(
|
||||||
@ -140,7 +140,7 @@ export class RapidApiService implements DataProviderInterface {
|
|||||||
headers: {
|
headers: {
|
||||||
useQueryString: 'true',
|
useQueryString: 'true',
|
||||||
'x-rapidapi-host': 'fear-and-greed-index.p.rapidapi.com',
|
'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-ignore
|
// @ts-ignore
|
||||||
signal: abortController.signal
|
signal: abortController.signal
|
||||||
|
@ -2,10 +2,14 @@ import { CleanedEnvAccessors } from 'envalid';
|
|||||||
|
|
||||||
export interface Environment extends CleanedEnvAccessors {
|
export interface Environment extends CleanedEnvAccessors {
|
||||||
ACCESS_TOKEN_SALT: string;
|
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_DEMO: string;
|
||||||
API_KEY_COINGECKO_PRO: 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_QUOTES_TTL: number;
|
||||||
CACHE_TTL: number;
|
CACHE_TTL: number;
|
||||||
DATA_SOURCE_EXCHANGE_RATES: string;
|
DATA_SOURCE_EXCHANGE_RATES: string;
|
||||||
@ -18,8 +22,6 @@ export interface Environment extends CleanedEnvAccessors {
|
|||||||
ENABLE_FEATURE_STATISTICS: boolean;
|
ENABLE_FEATURE_STATISTICS: boolean;
|
||||||
ENABLE_FEATURE_SUBSCRIPTION: boolean;
|
ENABLE_FEATURE_SUBSCRIPTION: boolean;
|
||||||
ENABLE_FEATURE_SYSTEM_MESSAGE: boolean;
|
ENABLE_FEATURE_SYSTEM_MESSAGE: boolean;
|
||||||
EOD_HISTORICAL_DATA_API_KEY: string;
|
|
||||||
FINANCIAL_MODELING_PREP_API_KEY: string;
|
|
||||||
GOOGLE_CLIENT_ID: string;
|
GOOGLE_CLIENT_ID: string;
|
||||||
GOOGLE_SECRET: string;
|
GOOGLE_SECRET: string;
|
||||||
GOOGLE_SHEETS_ACCOUNT: string;
|
GOOGLE_SHEETS_ACCOUNT: string;
|
||||||
@ -28,9 +30,7 @@ export interface Environment extends CleanedEnvAccessors {
|
|||||||
JWT_SECRET_KEY: string;
|
JWT_SECRET_KEY: string;
|
||||||
MAX_ACTIVITIES_TO_IMPORT: number;
|
MAX_ACTIVITIES_TO_IMPORT: number;
|
||||||
MAX_ITEM_IN_CACHE: number;
|
MAX_ITEM_IN_CACHE: number;
|
||||||
OPEN_FIGI_API_KEY: string;
|
|
||||||
PORT: number;
|
PORT: number;
|
||||||
RAPID_API_API_KEY: string;
|
|
||||||
REDIS_HOST: string;
|
REDIS_HOST: string;
|
||||||
REDIS_PASSWORD: string;
|
REDIS_PASSWORD: string;
|
||||||
REDIS_PORT: number;
|
REDIS_PORT: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user