-
-
Notifications
You must be signed in to change notification settings - Fork 638
Open
Labels
Description
Describe the feature
Instead of defining overridable empty values inside the (nitro|nuxt).config.ts
file, we should be able to define a schema using a validation library like zod or valibot.
Actual overridable values runtimeConfig
//https://nitro.unjs.io/config
export default defineNitroConfig({
srcDir: "server",
runtimeConfig: {
betterAuth: {
secret: "",
url: "",
},
turnstile: {
secretKey: "",
},
cronSecret: "",
upstash: {
redis: {
url: "",
token: "",
},
},
posthog: {
apiKey: "",
apiHost: "",
},
},
});
Schema based runtimeConfig
import { z } from "zod";
//https://nitro.unjs.io/config
export default defineNitroConfig({
srcDir: "server",
runtimeConfig: {
betterAuth: {
secret: z.string().min(32).max(32),
url: z.string().url(),
},
turnstile: {
secretKey: z.string().min(1),
},
cronSecret: z.string().min(1),
upstash: {
redis: {
url: z.string().min(1),
token: z.string().min(1),
},
},
posthog: {
apiKey: z.string().min(1),
apiHost: z.string().min(1),
},
},
});
Additional information
- Would you be willing to help implement this feature?
TanguyJct, zAlweNy26 and hareland