Skip to content

Commit 5047a6c

Browse files
committed
dev-bl/config-ip: Set netport via nc.js.
UNISYS.IniializeNetwork was not being called with any overrides. This introduces a netport override set by nc.js.
1 parent 2f14cd6 commit 5047a6c

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

build/brunch-server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ module.exports = (config, callback) => {
3333
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3434
/*/ This happens early because we need to inject UNISYS connection parameters
3535
into index.ejs
36-
/*/ let unetOptions = UNISYS.InitializeNetwork();
36+
/*/ let nc_options = { port: NC_CONFIG.netport };
37+
let unetOptions = UNISYS.InitializeNetwork( nc_options );
3738

3839
/// CONFIGURE EXPRESS /////////////////////////////////////////////////////////
3940
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

build/nc.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ let argv = require('minimist')(process.argv.slice(2));
55
let dataset = argv['dataset'];
66
let googlea = argv['googlea'];
77
let port = argv['port'];
8+
let netport = argv['netport'];
89
let ip = argv['ip'];
10+
11+
let netportDef;
912
let ipDef;
1013

1114
shell.echo(`
@@ -69,18 +72,36 @@ shell.echo(`
6972
);
7073

7174

75+
// netport
76+
if (netport === undefined || netport === '') {
77+
netportDef = '';
78+
shell.echo(`
79+
4. Using default netport
80+
Use './nc.js --netport=xxxx' to define a specific network port.
81+
(This is usually only needed when running multiple servers on the same host)`
82+
);
83+
} else {
84+
netportDef = `\n netport: "${netport}",`;
85+
shell.echo(`
86+
4. Setting netport to ${netport}
87+
Use './nc.js --netport=xxx.xxx.xxx' to define a specific network port.
88+
(This is usually only needed when running multiple servers on the same host)`
89+
);
90+
}
91+
92+
7293
// ip
7394
if (ip === undefined || ip === '') {
7495
ipDef = '';
7596
shell.echo(`
76-
4. Using default ip
97+
5. Using default ip
7798
Use './nc.js --ip=xxx.xxx.xxx' to define a specific ip address.
7899
(This is usually only needed on specialized hosts, e.g. EC2, Docker)`
79100
);
80101
} else {
81102
ipDef = `\n ip: "${ip}",`;
82103
shell.echo(`
83-
4. Setting ip to ${ip}
104+
5. Setting ip to ${ip}
84105
Use './nc.js --ip=xxx.xxx.xxx' to define a specific ip address.
85106
(This is usually only needed on specialized hosts, e.g. EC2, Docker)`
86107
);
@@ -90,16 +111,16 @@ if (ip === undefined || ip === '') {
90111
let script = `
91112
// this file generated by NC command
92113
const NC_CONFIG = {
93-
dataset: "${dataset}",${ipDef}
94-
port: "${port}",
114+
dataset: "${dataset}",
115+
port: "${port}",${netportDef}${ipDef}
95116
googlea: "${googlea}"
96117
};
97118
if (typeof process === "object") module.exports = NC_CONFIG;
98119
if (typeof window === "object") window.NC_CONFIG = NC_CONFIG;`
99120
let js = shell.ShellString(script).to('app/assets/netcreate-config.js');
100121

101122
shell.echo(`
102-
5. Starting dev server...
123+
6. Starting dev server...
103124
\n
104125
\n`);
105126

0 commit comments

Comments
 (0)