-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathkuai.config.js
More file actions
49 lines (44 loc) · 1.22 KB
/
kuai.config.js
File metadata and controls
49 lines (44 loc) · 1.22 KB
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
/**
* @module kuai.config
* @description
* Kuai configuration file
*/
require('dotenv').config()
let redisOpt = undefined
if (process.env.REDIS_OPT) {
try {
redisOpt = JSON.parse(process.env.REDIS_OPT)
} catch (error) {
//ignore error, if error redisOpt will be undefined
}
}
// fallback to REDISUSER due to https://github.com/ckb-js/kuai/pull/423#issuecomment-1668983983
const REDIS_USER = redisOpt?.username ?? process.env.REDISUSER
const REDIS_PASSWORD = redisOpt?.password ?? process.env.REDISPASSWORD
const REDIS_HOST = process.env.REDIS_HOST ?? process.env.REDISHOST
const REDIS_PORT = process.env.REDIS_PORT ?? process.env.REDISPORT
const redisAuth = REDIS_USER && REDIS_PASSWORD ? { username: REDIS_USER, password: REDIS_PASSWORD } : undefined
module.exports = {
host: process.env.HOST,
port: process.env.PORT,
network: 'testnet',
redisPort: REDIS_PORT,
redisHost: REDIS_HOST,
redisOpt:
redisOpt || redisAuth
? {
...redisOpt,
...redisAuth,
}
: undefined,
jest: {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['/__fixtures__/', '/__utils__/'],
globals: {
'ts-jest': {
diagnostics: false,
},
},
},
}