mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Parsing deviceType configs with %https.ip% and %http.ip%
This commit is contained in:
parent
86a45fec2e
commit
cef865f53a
@ -24,6 +24,7 @@ utility = function () {
|
|||||||
var log = new Log("/app/modules/utility.js");
|
var log = new Log("/app/modules/utility.js");
|
||||||
var JavaClass = Packages.java.lang.Class;
|
var JavaClass = Packages.java.lang.Class;
|
||||||
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;
|
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
|
var server = require("carbon")["server"];
|
||||||
|
|
||||||
var getOsgiService = function (className) {
|
var getOsgiService = function (className) {
|
||||||
return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className));
|
return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className));
|
||||||
@ -71,7 +72,10 @@ utility = function () {
|
|||||||
if (deviceTypeConfigFile.isExists()) {
|
if (deviceTypeConfigFile.isExists()) {
|
||||||
try {
|
try {
|
||||||
deviceTypeConfigFile.open("r");
|
deviceTypeConfigFile.open("r");
|
||||||
deviceTypeConfig = parse(deviceTypeConfigFile.readAll());
|
var config = deviceTypeConfigFile.readAll();
|
||||||
|
config = config.replace("%https.ip%", server.address("https"));
|
||||||
|
config = config.replace("%http.ip%", server.address("http"));
|
||||||
|
deviceTypeConfig = parse(config);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.error("Error while reading device config file for `" + deviceType + "`: " + err);
|
log.error("Error while reading device config file for `" + deviceType + "`: " + err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user