-
Notifications
You must be signed in to change notification settings - Fork 0
/
appconfig.js
49 lines (45 loc) · 1.13 KB
/
appconfig.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
47
48
49
var path = require('path');
var os = require('os');
var dns = require('dns');
var hostname = os.hostname();
module.exports = {
defaultDevServer: {
defaultIP: 'localhost',
defaultPort: 3000,
apiHost: 'open.iciba.com',
apiAddress: 'http://open.iciba.com:80/',
apiBashPath: '/dsapi/*',
gatewayHost: 'Teedys-MacBook-Pro.local'
},
alias: {
'AppCss': path.resolve(__dirname, 'src/css/app')
},
entry: {
app: path.resolve(__dirname, 'src/main')
},
getDevServer: function() {
var interfaces = os.networkInterfaces();
var server = {
hostname: hostname,
port: this.defaultDevServer.defaultPort,
ip: null,
gatewayHost: this.defaultDevServer.gatewayHost
};
for (var k in interfaces) {
for (var k2 in interfaces[k]) {
var address = interfaces[k][k2];
if (address.family === 'IPv4' && !address.internal) {
server.ip = (address.address);
break;
}
}
if (server.ip !== null) {
break;
}
}
if (server.ip === null) {
server.ip = this.defaultDevServer.defaultIP;
}
return server;
}
};