70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
import z from "zod";
|
|
|
|
export const _env = z
|
|
.object({
|
|
SERVER_HOST: z.string("Must be string."),
|
|
SERVER_PORT: z.coerce
|
|
.number("Must be number.")
|
|
.int("Must be integer.")
|
|
.min(0, "Min 0."),
|
|
|
|
DATABASE_HOST: z.string("Must be string.").nonempty("Must not empty."),
|
|
DATABASE_PORT: z.coerce
|
|
.number("Must be number.")
|
|
.int("Must be integer.")
|
|
.min(0, "Min 0."),
|
|
DATABASE_USERNAME: z.string("Must be string.").nonempty("Must not empty."),
|
|
DATABASE_PASSWORD: z.string("Must be string.").nonempty("Must not empty."),
|
|
DATABASE_NAME: z.string("Must be string.").nonempty("Must not empty."),
|
|
|
|
JWT_SECRET: z.string("Must be string.").nonempty("Must not empty."),
|
|
JWT_ALGORITHM: z.enum(
|
|
[
|
|
"HS256",
|
|
"HS384",
|
|
"HS512",
|
|
"RS256",
|
|
"RS384",
|
|
"RS512",
|
|
"ES256",
|
|
"ES384",
|
|
"ES512",
|
|
"PS256",
|
|
"PS384",
|
|
"PS512",
|
|
],
|
|
"Invalid value.",
|
|
),
|
|
JWT_ISSUER: z.string("Must be string.").nonempty("Must not empty."),
|
|
|
|
MIDTRANS_BASE_URL: z.url("Must be valid URL.").nonempty("Must not empty."),
|
|
MIDTRANS_MERCHANT_ID: z
|
|
.string("Must be string.")
|
|
.nonempty("Must not empty."),
|
|
MIDTRANS_SERVER_KEY: z
|
|
.string("Must be string.")
|
|
.nonempty("Must not empty."),
|
|
|
|
MAIL_HOST: z.string("Must be string.").nonempty("Must not empty."),
|
|
MAIL_PORT: z.coerce
|
|
.number("Must be number.")
|
|
.int("Must be integer.")
|
|
.min(0, "Min 0."),
|
|
MAIL_USERNAME: z.string("Must be string.").nonempty("Must not empty."),
|
|
MAIL_PASSWORD: z.string("Must be string.").nonempty("Must not empty."),
|
|
|
|
WHATSAPP_BUSINESS_ACCESS_TOKEN: z
|
|
.string("Must be string.")
|
|
.nonempty("Must not empty."),
|
|
WHATSAPP_BUSINESS_PHONE_NUMBER_ID: z
|
|
.string("Must be string.")
|
|
.nonempty("Must not empty."),
|
|
WHATSAPP_BUSINESS_ACCOUNT_ID: z
|
|
.string("Must be string.")
|
|
.nonempty("Must not empty."),
|
|
WHATSAPP_BUSINESS_WEBHOOK_VERIFY_TOKEN: z
|
|
.string("Must be string.")
|
|
.nonempty("Must not empty."),
|
|
})
|
|
.parse(Bun.env);
|