Created
March 16, 2014 02:28
-
-
Save dulichan/9577696 to your computer and use it in GitHub Desktop.
Get the runtime server address for jaggery application in the carbon environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getAddress = function(transport){ | |
var process = require("process"), | |
host = process.getProperty('server.host'), | |
ip = process.getProperty('carbon.local.ip'); | |
var log = new Log(); | |
var port; | |
if(transport=="http"){ | |
port = process.getProperty('mgt.transport.http.proxyPort'); | |
if(!port){ | |
//can use http.port as well | |
port = process.getProperty('mgt.transport.http.port'); | |
} | |
}else if(transport=="https"){ | |
port = process.getProperty('mgt.transport.https.proxyPort'); | |
if(!port){ | |
//can use https.port as well | |
port = process.getProperty('mgt.transport.https.port'); | |
} | |
} | |
var postUrl; | |
if(host=="localhost"){ | |
postUrl = "https://" + ip + ":" + port; | |
}else{ | |
postUrl = "https://" + host+ ":" +port; | |
} | |
return postUrl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment