feat(config): Add JSON schema for config

This commit is contained in:
Jesse Wierzbinski 2024-07-25 23:51:00 +02:00
parent d20988afa1
commit 7d1522cc1e
No known key found for this signature in database
5 changed files with 4023 additions and 2 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -1,3 +1,5 @@
#:schema config.schema.json
[database]
# Main PostgreSQL database connection
host = "localhost"
@ -412,7 +414,7 @@ duration_coeff = 1.0
# Amount to multiply every route's max requests per [duration] by
max_coeff = 1.0
[custom_ratelimits]
[ratelimits.custom]
# Add in any API route in this style here
# Applies before the global ratelimit changes
# "/api/v1/accounts/:id/block" = { duration = 30, max = 60 }

4012
config/config.schema.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -89,7 +89,8 @@
"drizzle-kit": "^0.23.0",
"oclif": "^4.14.9",
"ts-prune": "^0.10.3",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"zod-to-json-schema": "^3.23.1"
},
"peerDependencies": {
"typescript": "^5.3.2"

View file

@ -0,0 +1,6 @@
import { zodToJsonSchema } from "zod-to-json-schema";
import { configValidator } from "./config.type";
const jsonSchema = zodToJsonSchema(configValidator);
console.write(`${JSON.stringify(jsonSchema, null, 4)}\n`);