aboutsummaryrefslogtreecommitdiff
path: root/src/api/structures
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2021-01-10 02:04:35 +0200
committerZephyrrus <[email protected]>2021-01-10 02:04:35 +0200
commit46ef63fb9f3c2688118a9d1511293128cfdfe4c9 (patch)
tree5fc64b84464938f05470aeccd6066ac33922f590 /src/api/structures
parentfeat: create settings schema (used for rendering and validating) (diff)
downloadhost.fuwn.me-46ef63fb9f3c2688118a9d1511293128cfdfe4c9.tar.xz
host.fuwn.me-46ef63fb9f3c2688118a9d1511293128cfdfe4c9.zip
feat: add dynamic settings page rendering based on the Joi object
Diffstat (limited to 'src/api/structures')
-rw-r--r--src/api/structures/Setting.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/api/structures/Setting.js b/src/api/structures/Setting.js
index 068ebf1..7b2041d 100644
--- a/src/api/structures/Setting.js
+++ b/src/api/structures/Setting.js
@@ -9,15 +9,6 @@ const StatsGenerator = require('../utils/StatsGenerator');
// use meta to set custom rendering (render as radio instead of dropdown for example) and custom order
// use description to add comments which will show up as a note somewhere next to the option
const schema = Joi.object({
- // Server related settings
- rateLimitWindow: Joi.number().integer().default(2)
- .label('API rate limit window')
- .description('Timeframe for which requests are checked/remembered'),
-
- rateLimitMax: Joi.number().integer().default(5)
- .label('API maximum limit')
- .description('Max number of connections during windowMs milliseconds before sending a 429 response'),
-
// Service settings
serviceName: Joi.string().default('change-me')
.label('Service name')
@@ -118,9 +109,18 @@ const schema = Joi.object({
savedStatistics: Joi.array().items(Joi.string().valid(...Object.keys(StatsGenerator.statGenerators)).optional())
.meta({ displayType: 'checkbox' })
.label('Cached statistics')
- .description('Which statistics should be saved to the database (refer to Statistics schedule for scheduling). If a statistics is enabled but not set to be saved, it will be generated every time the statistics page is opened')
-});
+ .description('Which statistics should be saved to the database (refer to Statistics schedule for scheduling).')
+ .note('If a statistics is enabled but not set to be saved, it will be generated every time the statistics page is opened'),
-// schema._ids._byKey.keys()
+ // Server related settings
+ rateLimitWindow: Joi.number().integer().default(2)
+ .label('API rate limit window')
+ .description('Timeframe for which requests are checked/remembered'),
+
+ rateLimitMax: Joi.number().integer().default(5)
+ .label('API maximum limit')
+ .description('Max number of connections during windowMs milliseconds before sending a 429 response')
+});
module.exports.schema = schema;
+module.exports.configSchema = schema.describe();