feat: dev flags
This commit is contained in:
@@ -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')
|
||||
|
@@ -6,11 +6,16 @@ extend type Query {
|
||||
system: SystemQuery
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
system: SystemMutation
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# QUERIES
|
||||
# -----------------------------------------------
|
||||
|
||||
type SystemQuery {
|
||||
flags: [SystemFlag] @auth(requires: ["manage:system"])
|
||||
info: SystemInfo
|
||||
}
|
||||
|
||||
@@ -18,10 +23,26 @@ type SystemQuery {
|
||||
# MUTATIONS
|
||||
# -----------------------------------------------
|
||||
|
||||
type SystemMutation {
|
||||
updateFlags(
|
||||
flags: [SystemFlagInput]!
|
||||
): DefaultResponse @auth(requires: ["manage:system"])
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# TYPES
|
||||
# -----------------------------------------------
|
||||
|
||||
type SystemFlag {
|
||||
key: String!
|
||||
value: Boolean!
|
||||
}
|
||||
|
||||
input SystemFlagInput {
|
||||
key: String!
|
||||
value: Boolean!
|
||||
}
|
||||
|
||||
type SystemInfo {
|
||||
configFile: String @auth(requires: ["manage:system"])
|
||||
cpuCores: Int @auth(requires: ["manage:system"])
|
||||
|
Reference in New Issue
Block a user