Spaces:
Running
Running
File size: 2,336 Bytes
e4bf523 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 'use strict'
/**
* Copyright (c) 2017~2019, OBCon Inc.
* All rights reserved.
*/
/**
* @file
* @copyright 2017~2019, OBCon Inc.
* @author gye hyun james kim [pnuskgh@gmail.com]
*/
//--- Service, Site, Module별 설정 관리
//--- 동적 설정 : files/settings/${service}/setting.json, files/settings/${service}/${site}/setting.json
//--- 정적 설정 : custom/${service}/modules/${module}/setting.js, modules/${module}/setting.js
class Setting {
constructor() {
// this._values = null;
}
getSettings() {
return {};
}
_getSetting(name, defaultValue=null) {
const mySettings = this.getSettings();
return mySettings[name] || defaultValue;
// if (utils.existField(mySettings, name)) {
// return mySettings[name];
// }
// return defaultValue;
}
getSetting(name, defaultValue=null) {
return this._getSetting(name, defaultValue);
}
getSetting2(name1, name2, defaultValue=null) {
const mySettings = this.getSetting(name1, null);
if (mySettings != null) {
return mySettings[name2] || defaultValue;
}
return defaultValue;
}
// _getValue(site, action, name, defaultValue) {
// let values = this.getDefaultValues();
// if ((site == null) || (utils.existField(values.sites, site) == false)) {
// if (utils.existField(values, action)) {
// if (utils.existField(values[action], name)) {
// return values[action][name];
// }
// }
// return defaultValue;
// }
// if (utils.existField(values.sites[site], action)) {
// if (utils.existField(values.sites[site][action], name)) {
// return values.sites[site][action][name];
// }
// }
// return this._getValue(null, action, name, defaultValue);
// }
// getValue(site, action, name, defaultValue) {
// if (arguments.length == 4) {
// return this._getValue(site, action, name, defaultValue);
// } else {
// return this._getValue(site, action, name, null);
// }
// }
}
module.exports = Setting;
|