-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
46 lines (44 loc) · 1.48 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
const config = {
UDP: {
LISTEN_PORT: process.env.UDP_LISTEN_PORT || 67,
REMOTE_PORT: process.env.UDP_REMOTE_PORT || 67,
REMOTE_HOST: process.env.UDP_REMOTE_HOST || 'localhost',
REMOTE_HOST_IP: ''
},
FILES: {
DIR: process.env.STORE_DIR || './data/',
ACTIVE_BUFFER_FILE_EXTENSION: 'active',
INACTIVE_BUFFER_FILE_EXTENSION: 'stored',
ENCRYPTED_BUFFER_FILE_EXTENSION: 'encrypted',
ACTIVE_BUFFER_MAX_SIZE: process.env.ACTIVE_BUFFER_MAX_SIZE || '32k',
ACTIVE_BUFFER_MAX_AGE: process.env.ACTIVE_BUFFER_MAX_AGE || 60
},
ENCRYPT: {
ENABLED: process.env.ENCRYPT_DATA || 'true',
PASSWORD: process.env.ENCRYPT_PASSWORD || 'testPass',
PASSWORD_HASH_ALGHORITM: 'sha256',
ALGORITHM: 'aes-256-cbc',
}
};
const configForTests = {
UDP: {
LISTEN_PORT: process.env.UDP_LISTEN_PORT || 12345,
REMOTE_PORT: process.env.UDP_REMOTE_PORT || 12345,
REMOTE_HOST: process.env.UDP_REMOTE_HOST || 'localhost'
},
FILES: {
DIR: process.env.STORE_DIR || './data/',
ACTIVE_BUFFER_FILE_EXTENSION: 'active',
INACTIVE_BUFFER_FILE_EXTENSION: 'stored',
ENCRYPTED_BUFFER_FILE_EXTENSION: 'encrypted',
ACTIVE_BUFFER_MAX_SIZE: process.env.ACTIVE_BUFFER_MAX_SIZE || '1k',
ACTIVE_BUFFER_MAX_AGE: process.env.ACTIVE_BUFFER_MAX_AGE || 1
},
ENCRYPT: {
ENABLED: process.env.ENCRYPT_DATA || true,
PASSWORD: process.env.ENCRYPT_PASSWORD || 'testPass',
PASSWORD_HASH_ALGHORITM: 'sha256',
ALGORITHM: 'aes-256-cbc',
}
};
module.exports = (process.env.NODE_ENV === 'test') ? configForTests : config;