Refactor mailer setup and validate web configuration in app
This commit refactors how SMTP configuration for mailers is set up and introduces schema validation for incoming configurations. The mailer modules have been restructured, with schema definition files added, and redundant codes removed. Moreover, web application configuration now has minimum validation on name and title, and URL validation has been added.
This commit is contained in:
@@ -8,11 +8,27 @@ enum Themes {
|
||||
}
|
||||
|
||||
const AppConfigSchema = z.object({
|
||||
name: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
url: z.string(),
|
||||
locale: z.string().default('en'),
|
||||
name: z
|
||||
.string({
|
||||
description: `This is the name of your SaaS. Ex. "Makerkit"`,
|
||||
})
|
||||
.min(1),
|
||||
title: z
|
||||
.string({
|
||||
description: `This is the default title tag of your SaaS.`,
|
||||
})
|
||||
.min(1),
|
||||
description: z.string({
|
||||
description: `This is the default description of your SaaS.`,
|
||||
}),
|
||||
url: z.string().url({
|
||||
message: `Please provide a valid URL. Example: 'https://example.com'`,
|
||||
}),
|
||||
locale: z
|
||||
.string({
|
||||
description: `This is the default locale of your SaaS.`,
|
||||
})
|
||||
.default('en'),
|
||||
theme: z.nativeEnum(Themes),
|
||||
production: z.boolean(),
|
||||
themeColor: z.string(),
|
||||
|
||||
@@ -6,8 +6,12 @@ const providers: z.ZodType<Provider> = getProviders();
|
||||
|
||||
const AuthConfigSchema = z.object({
|
||||
providers: z.object({
|
||||
password: z.boolean(),
|
||||
magicLink: z.boolean(),
|
||||
password: z.boolean({
|
||||
description: 'Enable password authentication.',
|
||||
}),
|
||||
magicLink: z.boolean({
|
||||
description: 'Enable magic link authentication.',
|
||||
}),
|
||||
oAuth: providers.array(),
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user