From 8f87546aeb5c14539601ab25c0e07630a5e5043a Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Mon, 24 May 2021 20:47:06 +0200 Subject: :sparkles: use new config --- src/util/Config.ts | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'src/util/Config.ts') diff --git a/src/util/Config.ts b/src/util/Config.ts index 89f35901..e2e0d312 100644 --- a/src/util/Config.ts +++ b/src/util/Config.ts @@ -1,6 +1,7 @@ -import Ajv, { JSONSchemaType } from "ajv" +// @ts-nocheck +import Ajv, { JSONSchemaType } from "ajv"; import { getConfigPathForFile } from "@fosscord/server-util/dist/util/Config"; -import {Config} from "@fosscord/server-util" +import { Config } from "@fosscord/server-util"; export interface RateLimitOptions { count: number; @@ -95,11 +96,10 @@ export interface DefaultOptions { }; } - const schema: JSONSchemaType & { definitions: { - rateLimitOptions: JSONSchemaType - } + rateLimitOptions: JSONSchemaType; + }; } = { type: "object", definitions: { @@ -107,10 +107,10 @@ const schema: JSONSchemaType & { type: "object", properties: { count: { type: "number" }, - timespan: { type: "number" }, + timespan: { type: "number" } }, - required: ["count", "timespan"], - }, + required: ["count", "timespan"] + } }, properties: { gateway: { @@ -238,8 +238,8 @@ const schema: JSONSchemaType & { auth: { type: "object", properties: { - login: { $ref: '#/definitions/rateLimitOptions' }, - register: { $ref: '#/definitions/rateLimitOptions' } + login: { $ref: "#/definitions/rateLimitOptions" }, + register: { $ref: "#/definitions/rateLimitOptions" } }, nullable: true, required: [], @@ -348,18 +348,25 @@ const schema: JSONSchemaType & { additionalProperties: false } }, - required: ["allowMultipleAccounts", "allowNewRegistration", "dateOfBirth", "email", "password", "requireCaptcha", "requireInvite"], + required: [ + "allowMultipleAccounts", + "allowNewRegistration", + "dateOfBirth", + "email", + "password", + "requireCaptcha", + "requireInvite" + ], additionalProperties: false - }, + } }, required: ["gateway", "general", "limits", "login", "permissions", "register", "security"], additionalProperties: false -} - +}; const ajv = new Ajv(); const validator = ajv.compile(schema); const configPath = getConfigPathForFile("fosscord", "api", ".json"); -export const apiConfig = new Config({path: configPath, schemaValidator: validator, schema: schema}); \ No newline at end of file +export const apiConfig = new Config({ path: configPath, schemaValidator: validator, schema: schema }); -- cgit 1.5.1