Commit 934897b153a0b650107b4da4a93ae9448a1f183a

Authored by Adhidarma Hadiwinoto
1 parent 5ff6c791ef
Exists in master

config.default_host_options

Showing 1 changed file with 3 additions and 2 deletions Inline Diff

1 "use strict"; 1 "use strict";
2 2
3 process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; 3 process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
4 4
5 const fs = require('fs'); 5 const fs = require('fs');
6 const config = require(__dirname + '/config.json'); 6 const config = require(__dirname + '/config.json');
7 7
8 fs.existsSync('certs') || fs.mkdirSync('certs'); 8 fs.existsSync('certs') || fs.mkdirSync('certs');
9 9
10 const redbird = require('redbird')(config.server_options); 10 const redbird = require('redbird')(config.server_options);
11 11
12 const hostsCount = config.hosts.length; 12 const hostsCount = config.hosts.length;
13 for (let i=0; i < hostsCount; i++) { 13 for (let i=0; i < hostsCount; i++) {
14 let host = config.hosts[i] 14 let host = config.hosts[i]
15 console.log(`Registering ${host.host} to ${host.target}`); 15 console.log(`Registering ${host.host} to ${host.target}`);
16 if (!host.disable) { 16 if (!host.disable) {
17 if (!host.options) { 17 const options = host.options ? config.default_host_options;
18 if (!options) {
18 redbird.register(host.host, host.target); 19 redbird.register(host.host, host.target);
19 } 20 }
20 else { 21 else {
21 redbird.register(host.host, host.target, host.options); 22 redbird.register(host.host, host.target, options);
22 } 23 }
23 24
24 } 25 }
25 } 26 }
26 27