-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ts
45 lines (35 loc) · 1.25 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import dotEnv from 'dotenv';
dotEnv.config();
function getEnvVariable(key: string, required?: true): string;
function getEnvVariable(key: string, required: false): string | undefined;
function getEnvVariable(key: string, required = true) {
const value = process.env[key];
if (required && value === undefined) {
throw new Error(`Env variable "${key}" is required`);
}
return value;
}
const envApiPort = getEnvVariable('UI_API_PORT', false);
const envDatasourceFetchTiemout = getEnvVariable(
'DATASOURCE_FETCH_TIMEOUT',
false
);
export const UI_API_PORT = envApiPort ? parseInt(envApiPort) : 3000;
export const MONGO_DB_URL = getEnvVariable('MONGO_DB_URL');
export const DATASOURCE_HOSTNAME = getEnvVariable('DATASOURCE_HOSTNAME');
export const DATASOURCE_FETCH_TIMEOUT = envDatasourceFetchTiemout
? parseInt(envDatasourceFetchTiemout, 10)
: 3000;
export const TELEGRAM_BOT_TOKEN = getEnvVariable('TELEGRAM_BOT_TOKEN');
export const SENTRY_DSN = getEnvVariable('SENTRY_DSN', false);
export const DATADOG_API_KEY = getEnvVariable('DATADOG_API_KEY', false);
export const MAX_ITEM_PRICE = 99_000_000_000_000;
export const SERVERS: { [key: string]: number } = {
AIRIN: 45,
ELCARDIA: 27,
HATOS: 12,
NAGA: 15,
SIRRA: 16,
CADMUS: 501,
FARIS: 23
};