This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
config.js
128 lines (116 loc) · 4.15 KB
/
config.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* LiskHQ/lisk-service
* Copyright © 2021 Lisk Foundation
*
* See the LICENSE file at the top-level directory of this distribution
* for licensing information.
*
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
* no part of this software, including this file, may be copied, modified,
* propagated, or distributed except according to the terms contained in the
* LICENSE file.
*
* Removal or modification of this copyright notice is prohibited.
*
*/
const packageJson = require('./package.json');
const config = {
endpoints: {},
market: {},
};
// Moleculer broker config
config.transporter = process.env.SERVICE_BROKER || 'redis://lisk:[email protected]:6379/0';
config.brokerTimeout = Number(process.env.SERVICE_BROKER_TIMEOUT) || 10; // in seconds
// Logging
config.log = {
name: packageJson.name,
version: packageJson.version,
};
/**
* log.level - Limits the importance of log messages for console and stdout outputs
* One fo the following in that order:
* TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK
*/
config.log.level = process.env.SERVICE_LOG_LEVEL || 'info';
/*
* True / False outputs
* log.console - Plain JavaScript console.log() output
* log.stdout - Writes directly to stdout
*/
config.log.console = process.env.SERVICE_LOG_CONSOLE || 'false';
config.log.stdout = process.env.SERVICE_LOG_STDOUT || 'true';
/*
* Configurable outputs
* log.file - outputs to a file (ie. ./logs/app.log)
* log.gelf - Writes to GELF-compatible socket (ie. 127.0.0.1:12201/udp)
*/
config.log.gelf = process.env.SERVICE_LOG_GELF || 'false';
config.log.file = process.env.SERVICE_LOG_FILE || 'false';
// Set docker host if running inside the container
config.log.docker_host = process.env.DOCKER_HOST || 'local';
// Api keys to access apis
config.access_key = {};
config.access_key.exchangeratesapi = process.env.EXCHANGERATESAPI_IO_API_KEY;
// Expiry time for redis
config.ttl = {
exchangeratesapi: 24 * 60 * 60 * 1000, // milliseconds,
binance: 15 * 60 * 1000, // milliseconds
bittrex: 15 * 60 * 1000, // milliseconds
kraken: 15 * 60 * 1000, // milliseconds
};
/**
* External endpoints
*/
config.endpoints.redis =
process.env.SERVICE_MARKET_REDIS || 'redis://lisk:[email protected]:6379/6';
/**
* Market prices config
*/
// SERVICE_MARKET_FIAT_CURRENCIES & SERVICE_MARKET_TARGET_PAIRS should be CSV-based strings
config.market.supportedFiatCurrencies =
process.env.SERVICE_MARKET_FIAT_CURRENCIES || 'EUR,USD,CHF,GBP,RUB,PLN,JPY,AUD,GBP,INR';
config.market.targetPairs =
process.env.SERVICE_MARKET_TARGET_PAIRS ||
'LSK_BTC,LSK_EUR,LSK_USD,LSK_CHF,LSK_PLN,LSK_JPY,LSK_AUD,LSK_GBP,LSK_INR,BTC_EUR,BTC_USD,BTC_CHF';
config.market.sources = {
binance: {
apiEndpoint: 'https://api.binance.com/api/v3',
allowRefreshAfter: 1 * 60 * 1000, // milliseconds
},
bittrex: {
apiEndpoint: 'https://api.bittrex.com/v3',
allowRefreshAfter: 1 * 60 * 1000, // milliseconds
},
exchangeratesapi: {
apiEndpoint: 'http://api.exchangeratesapi.io/v1',
allowRefreshAfter: 8 * 60 * 60 * 1000, // milliseconds
},
kraken: {
apiEndpoint: 'https://api.kraken.com/0',
allowRefreshAfter: 1 * 60 * 1000, // milliseconds
},
};
config.job = {
// Interval takes priority over schedule and must be greater than 0 to be valid
refreshPricesBinance: {
interval: Number(process.env.JOB_INTERVAL_REFRESH_PRICES_BINANCE) || 0,
schedule: process.env.JOB_SCHEDULE_REFRESH_PRICES_BINANCE || '* * * * *',
},
refreshPricesBittrex: {
interval: Number(process.env.JOB_INTERVAL_REFRESH_PRICES_BITTREX) || 0,
schedule: process.env.JOB_SCHEDULE_REFRESH_PRICES_BITTREX || '* * * * *',
},
refreshPricesExchangeratesapi: {
interval: Number(process.env.JOB_INTERVAL_REFRESH_PRICES_EXCHANGERATESAPI) || 0,
schedule: process.env.JOB_SCHEDULE_REFRESH_PRICES_EXCHANGERATESAPI || '* * * * *',
},
refreshPricesKraken: {
interval: Number(process.env.JOB_INTERVAL_REFRESH_PRICES_KRAKEN) || 0,
schedule: process.env.JOB_SCHEDULE_REFRESH_PRICES_KRAKEN || '* * * * *',
},
updatePrices: {
interval: Number(process.env.JOB_INTERVAL_UPDATE_PRICES) || 5,
schedule: process.env.JOB_SCHEDULE_UPDATE_PRICES || '',
},
};
module.exports = config;