+import { ServerConfigManager } from '@server/lib/server-config-manager'
import * as express from 'express'
import { remove, writeJSON } from 'fs-extra'
import { snakeCase } from 'lodash'
import validator from 'validator'
-import { getServerConfig } from '@server/lib/config'
import { UserRight } from '../../../shared'
import { About } from '../../../shared/models/server/about.model'
import { CustomConfig } from '../../../shared/models/server/custom-config.model'
const auditLogger = auditLoggerFactory('config')
configRouter.get('/about', getAbout)
+
configRouter.get('/',
asyncMiddleware(getConfig)
)
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
getCustomConfig
)
+
configRouter.put('/custom',
authenticate,
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
customConfigUpdateValidator,
asyncMiddleware(updateCustomConfig)
)
+
configRouter.delete('/custom',
authenticate,
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
)
async function getConfig (req: express.Request, res: express.Response) {
- const json = await getServerConfig(req.ip)
+ const json = await ServerConfigManager.Instance.getServerConfig(req.ip)
return res.json(json)
}
}
}
- return res.json(about).end()
+ return res.json(about)
}
function getCustomConfig (req: express.Request, res: express.Response) {
const data = customConfig()
- return res.json(data).end()
+ return res.json(data)
}
async function deleteCustomConfig (req: express.Request, res: express.Response) {
signup: {
enabled: CONFIG.SIGNUP.ENABLED,
limit: CONFIG.SIGNUP.LIMIT,
- requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION
+ requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION,
+ minimumAge: CONFIG.SIGNUP.MINIMUM_AGE
},
admin: {
email: CONFIG.ADMIN.EMAIL