Settings resource; oauth2 app authorization model; UI cleanup
This commit is contained in:
24
app/unit/SettingsUnit.js
Normal file
24
app/unit/SettingsUnit.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { Unit } = require('libflitter')
|
||||
|
||||
class SettingsUnit extends Unit {
|
||||
static get name() {
|
||||
return 'settings'
|
||||
}
|
||||
|
||||
static get services() {
|
||||
return [...super.services, 'configs', 'models', 'output']
|
||||
}
|
||||
|
||||
async go(app) {
|
||||
const Setting = this.models.get('Setting')
|
||||
const default_settings = this.configs.get('setting.settings')
|
||||
for ( const key in default_settings ) {
|
||||
if ( !default_settings.hasOwnProperty(key) ) continue
|
||||
const default_value = default_settings[key]
|
||||
this.output.debug(`Guarantee setting key "${key}" with default value "${default_value}".`)
|
||||
await Setting.guarantee(key, default_value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = SettingsUnit
|
||||
Reference in New Issue
Block a user