wiki/server/core/config.js
/**
   * Save config to DB
   *
   * @param {Array} keys Array of keys to save
   * @returns Promise
   */
Save config to DB
@param {Array} keys Array of keys to save
@returns Promise
Save config to DB @param { Array } keys Array of keys to save @returns Promise
async saveToDb(keys, propagate = true) {
    try {
      for (let key of keys) {
        let value = _.get(WIKI.config, key, null)
        if (!_.isPlainObject(value)) {
          value = { v: value }
        }
        let affectedRows = await WIKI.models.settings.query().patch({ value }).where('key', key)
        if (affectedRows === 0 && value) {
          await WIKI.models.settings.query().insert({ key, value })
        }
      }
      if (propagate) {
        WIKI.events.outbound.emit('reloadConfig')
      }
    } catch (err) {
      WIKI.logger.error(`Failed to save configuration to DB: ${err.message}`)
      return false
    }
    return true
  }
async saveToDb ( keys , propagate = true ) { try { for ( let key of keys ) { let value = _ . get ( WIKI . config , key , null ) if ( ! _ . isPlainObject ( value ) ) { value = { v : value } } let affectedRows = await WIKI . models . settings . query ( ) . patch ( { value } ) . where ( 'key' , key ) if ( affectedRows === 0 && value ) { await WIKI . models . settings . query ( ) . insert ( { key , value } ) } } if ( propagate ) { WIKI . events . outbound . emit ( 'reloadConfig' ) } } catch ( err ) { WIKI . logger . error ( ` ${ err . message } ` ) return false } return true }
Save config to DB
 @param {Array} keys Array of keys to save
 @returns Promise
Save config to DB @param { Array } keys Array of keys to save @returns Promise