Commit 40c4d6619dc7d8fdeb2b2ec44a7a7cc0b567dfb6

Authored by Adhidarma Hadiwinoto
1 parent ad442cb2f3
Exists in master

Quickfix for a typo

Showing 1 changed file with 2 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 URL = require('url'); 5 const URL = require('url');
6 const fs = require('fs'); 6 const fs = require('fs');
7 const isIp = require('is-ip'); 7 const isIp = require('is-ip');
8 const config = require(__dirname + '/config.json'); 8 const config = require(__dirname + '/config.json');
9 9
10 fs.existsSync('certs') || fs.mkdirSync('certs'); 10 fs.existsSync('certs') || fs.mkdirSync('certs');
11 11
12 const redbird = require('redbird')(config.server_options); 12 const redbird = require('redbird')(config.server_options);
13 13
14 const hostsCount = config.hosts.length; 14 const hostsCount = config.hosts.length;
15 for (let i=0; i < hostsCount; i++) { 15 for (let i=0; i < hostsCount; i++) {
16 let host = config.hosts[i] 16 let host = config.hosts[i]
17 console.log(`Registering ${host.host} to ${host.target}`); 17 console.log(`Registering ${host.host} to ${host.target}`);
18 if (!host.disable) { 18 if (!host.disable) {
19 const options = host.options || config.default_host_options; 19 const options = host.options || config.default_host_options;
20 const optionsWoSSL = JSON.parse(JSON.stringify(options)); 20 const optionsWoSSL = JSON.parse(JSON.stringify(options));
21 delete optionsWoSSL.ssl; 21 delete optionsWoSSL.ssl;
22 22
23 if (!options) { 23 if (!options) {
24 redbird.register(host.host, host.target); 24 redbird.register(host.host, host.target);
25 } 25 }
26 else { 26 else {
27 27
28 if isIp(URL.parse(host.host).hostname) { 28 if (isIp(URL.parse(host.host).hostname)) {
29 redbird.register(host.host, host.target, optionsWoSSL); 29 redbird.register(host.host, host.target, optionsWoSSL);
30 } 30 }
31 else { 31 else {
32 redbird.register(host.host, host.target, options); 32 redbird.register(host.host, host.target, options);
33 } 33 }
34 34
35 } 35 }
36 36
37 } 37 }
38 } 38 }
39 39