mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
feat(config): ✨ Add JSON schema for config
This commit is contained in:
parent
d20988afa1
commit
7d1522cc1e
|
|
@ -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
4012
config/config.schema.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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"
|
||||
|
|
|
|||
6
packages/config-manager/json-schema.ts
Normal file
6
packages/config-manager/json-schema.ts
Normal 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`);
|
||||
Loading…
Reference in a new issue