Refactoring device-mgt-props

revert-70aa11f8
dilanua 8 years ago
parent 7e7549437b
commit 225b1ddc45

@ -17,23 +17,23 @@
*/ */
var config = function () { var config = function () {
var conf = application.get("PINCH_CONFIG"); var conf = application.get("UI_CONFIG");
if (!conf) { if (!conf) {
var pinch = require('/app/modules/pinch.min.js').pinch; var pinch = require("/app/modules/pinch.min.js")["pinch"];
var server = require('carbon').server; var server = require("carbon")["server"];
var config = require('/app/conf/config.json'); var config = require("/app/conf/config.json");
pinch(config, /^/, function (path, key, value) { pinch(config, /^/, function (path, key, value) {
if ((typeof value === 'string') && value.indexOf('%https.ip%') > -1) { if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) {
return value.replace('%https.ip%', server.address("https")); return value.replace("%https.ip%", server.address("https"));
} else if ((typeof value === 'string') && value.indexOf('%http.ip%') > -1) { } else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) {
return value.replace('%http.ip%', server.address("http")); return value.replace("%http.ip%", server.address("http"));
} else if ((typeof value === 'string') && value.indexOf('%date-year%') > -1) { } else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) {
var year = new Date().getFullYear(); var year = new Date().getFullYear();
return value.replace("%date-year%", year); return value.replace("%date-year%", year);
} }
return value; return value;
}); });
application.put("PINCH_CONFIG", config); application.put("UI_CONFIG", config);
conf = config; conf = config;
} }
return conf; return conf;

Loading…
Cancel
Save