Spaces:
Running
Running
| /** | |
| * 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; | |