mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Now UI configs supports system parameters with eg. %iot.core.host%
This commit is contained in:
parent
27e953cda3
commit
252eb78124
@ -36,8 +36,23 @@ var conf = function () {
|
||||
} else if ((typeof value === "string") && value.indexOf("%server.ip%") > -1) {
|
||||
var getProperty = require("process").getProperty;
|
||||
return value.replace("%server.ip%", getProperty("carbon.local.ip"));
|
||||
} else {
|
||||
var paramPattern = new RegExp("%(.*?)%", "g");
|
||||
var out = value;
|
||||
while ((matches = paramPattern.exec(value)) !== null) {
|
||||
// This is necessary to avoid infinite loops with zero-width matches
|
||||
if (matches.index === paramPattern.lastIndex) {
|
||||
paramPattern.lastIndex++;
|
||||
}
|
||||
if (matches.length == 2) {
|
||||
var property = process.getProperty(matches[1]);
|
||||
if (property) {
|
||||
out = out.replace(new RegExp("%" + matches[1] + "%", "g"), property);
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
);
|
||||
application.put("CONF", conf);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user