-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathconfig.js
35 lines (31 loc) · 1.01 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
const { readFileSync } = require('fs');
let privateKey;
if (process.env.TKPK) {
privateKey = readFileSync(process.env.TKPK, 'utf-8');
}
const config = {
transport: process.env.TKTRANSPORT || 'ssh',
verbose: !!process.env.TKVERBOSE,
transportOptions: {
database: process.env.TKDB || '*LOCAL',
username: process.env.TKUSER || '',
password: process.env.TKPASS || '',
host: process.env.TKHOST || 'localhost',
port: process.env.TKPORT,
path: process.env.TKPATH || '/cgi-bin/xmlcgi.pgm',
url: process.env.TKURL,
privateKey,
// passphrase is used by the ssh transport to decrypt the private key
passphrase: process.env.TKPHRASE,
dsn: process.env.TKDSN,
},
};
function printConfig() {
/* eslint-disable no-console */
console.log('-----------------------');
console.log('transport:', config.transport);
console.log(`verbose: ${config.verbose ? 'on' : 'off'}`);
console.log('-----------------------');
}
module.exports.config = config;
module.exports.printConfig = printConfig;