mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
optimized getting the server port
This commit is contained in:
parent
44e96a63de
commit
3255cd725f
1 changed files with 23 additions and 11 deletions
34
server.js
34
server.js
|
|
@ -47,6 +47,8 @@ var CloudServer={
|
|||
/* name of direcotory with libs */
|
||||
LIBDIR :'./lib',
|
||||
LIBDIRSERVER :'./lib/server'
|
||||
Port :31337, /* server port */
|
||||
IP :'127.0.0.1'
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -203,24 +205,34 @@ CloudServer.start=function()
|
|||
{
|
||||
CloudServer.init();
|
||||
|
||||
/* constant ports of deployng servers */
|
||||
var lCloudFoundryPort = process.env.VCAP_APP_PORT;
|
||||
var lNodesterPort = process.env.app_port;
|
||||
var lC9Port = process.env.PORT;
|
||||
|
||||
/* constant ports of deployng servers
|
||||
var lCloudFoundryPort = process.env.VCAP_APP_PORT;
|
||||
var lNodesterPort = process.env.app_port;
|
||||
var lC9Port = process.env.PORT;
|
||||
*/
|
||||
CloudServer.Port = process.env.PORT /* c9 */
|
||||
|| process.env.app_port /* nodester */
|
||||
|| process.env.VCAP_APP_PORT /* cloudfoundry */
|
||||
|| CloudServer.Port;
|
||||
|
||||
CloudServer.IP = process.env.IP /* c9 */
|
||||
|| CloudServer.IP;
|
||||
|
||||
var http = require('http');
|
||||
http.createServer(CloudServer._controller).listen(
|
||||
lC9Port ||
|
||||
lCloudFoundryPort ||
|
||||
lNodesterPort ||
|
||||
31337,
|
||||
'0.0.0.0' || '127.0.0.1');
|
||||
console.log('Cloud Commander server running at http://127.0.0.1:' +
|
||||
CloudServer.Port,
|
||||
CloudServer.IP);
|
||||
|
||||
console.log('Cloud Commander server running at http://' +
|
||||
CloudServer.IP
|
||||
+ ':' + CloudServer.Port);
|
||||
/*
|
||||
(!lC9Port?
|
||||
(!lCloudFoundryPort?
|
||||
(!lNodesterPort?31337:lNodesterPort)
|
||||
:lCloudFoundryPort)
|
||||
:lC9Port));
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue