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
/
Copy pathconfig.js
74 lines (67 loc) · 2.59 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
/*
* LiskHQ/lisk-service
* Copyright © 2022 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: {},
log: {
name: packageJson.name,
version: packageJson.version,
},
};
/**
* Inter-service message broker
*/
config.transporter = process.env.SERVICE_BROKER || 'redis://lisk:[email protected]:6379/0';
config.brokerTimeout = Number(process.env.SERVICE_BROKER_TIMEOUT) || 10; // in seconds
/**
* External endpoints
*/
config.endpoints.cache =
process.env.SERVICE_FEE_ESTIMATOR_CACHE || 'redis://lisk:[email protected]:6379/1';
config.feeEstimates = {
quickAlgorithmEnabled: String(process.env.ENABLE_FEE_ESTIMATOR_QUICK).toLowerCase() !== 'false',
fullAlgorithmEnabled: String(process.env.ENABLE_FEE_ESTIMATOR_FULL).toLowerCase() === 'true',
coldStartBatchSize: Number(process.env.FEE_EST_COLD_START_BATCH_SIZE) || 1,
defaultStartBlockHeight: Number(process.env.FEE_EST_DEFAULT_START_BLOCK_HEIGHT) || 1,
medEstLowerPercentile: 25,
medEstUpperPercentile: 75,
highEstLowerPercentile: 80,
highEstUpperPercentile: 100,
emaBatchSize: Number(process.env.FEE_EST_EMA_BATCH_SIZE) || 20,
emaDecayRate: Number(process.env.FEE_EST_EMA_DECAY_RATE) || 0.5,
wavgDecayPercentage: Number(process.env.FEE_EST_WAVG_DECAY_PERCENTAGE) || 10,
};
config.cacheKeys = Object.freeze({
cacheKeyFeeEstFull: 'lastFeeEstimateFull',
cacheKeyFeeEstQuick: 'lastFeeEstimateQuick',
});
/**
* LOGGING
*
* log.level - TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK
* log.console - Plain JavaScript console.log() output (true/false)
* log.stdout - Writes directly to stdout (true/false)
* 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.level = process.env.SERVICE_LOG_LEVEL || 'info';
config.log.console = process.env.SERVICE_LOG_CONSOLE || 'false';
config.log.stdout = process.env.SERVICE_LOG_STDOUT || 'true';
config.log.gelf = process.env.SERVICE_LOG_GELF || 'false';
config.log.file = process.env.SERVICE_LOG_FILE || 'false';
config.log.docker_host = process.env.DOCKER_HOST || 'local';
config.debug = process.env.SERVICE_LOG_LEVEL === 'debug';
module.exports = config;