feat: dev flags

This commit is contained in:
Nick
2019-02-23 18:22:25 -05:00
parent bf505e6901
commit 2141366335
11 changed files with 124 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ const filesize = require('filesize')
const path = require('path')
const fs = require('fs-extra')
const moment = require('moment')
const graphHelper = require('../../helpers/graph')
/* global WIKI */
@@ -21,9 +22,29 @@ module.exports = {
Query: {
async system() { return {} }
},
Mutation: {
async system() { return {} }
},
SystemQuery: {
flags() {
return _.transform(WIKI.config.flags, (result, value, key) => {
result.push({ key, value })
}, [])
},
async info() { return {} }
},
SystemMutation: {
async updateFlags(obj, args, context) {
WIKI.config.flags = _.transform(args.flags, (result, row) => {
_.set(result, row.key, row.value)
}, {})
await WIKI.configSvc.applyFlags()
await WIKI.configSvc.saveToDb(['flags'])
return {
responseResult: graphHelper.generateSuccess('System Flags applied successfully')
}
}
},
SystemInfo: {
configFile() {
return path.join(process.cwd(), 'config.yml')