Skip to content

Commit

Permalink
fix client schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjam committed Aug 28, 2024
1 parent a31450a commit 861cb67
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/schemas/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@ export const configServerSchema = processEnvSchema
.omit({ SITE_URL: true, PREVIEW_MODE: true })
.extend({ PREVIEW_MODE: z.boolean() }); // here its boolean, not 'true' | 'false'

export const configClientSchema = processEnvSchema.pick({ SITE_URL: true }).merge(
z.object({
SITE_TITLE: z.string().min(1),
SITE_DESCRIPTION: z.string().min(1),
PAGE_SIZE_POST_CARD: z.number(),
PAGE_SIZE_POST_CARD_SMALL: z.number(),
MORE_POSTS_COUNT: z.number(),
DEFAULT_MODE: z.enum(modeValues), // check that theme and mode match
DEFAULT_THEME: z.enum(themeValues),
AUTHOR_NAME: z.string().min(1),
AUTHOR_EMAIL: z.string().email(),
AUTHOR_GITHUB: z.string().url(),
AUTHOR_LINKEDIN: z.string().url(),
AUTHOR_TWITTER: z.string().url(),
AUTHOR_YOUTUBE: z.string().url(),
REPO_URL: z.string().url(),
})
);
export const configClientSchema = processEnvSchema
.pick({ SITE_URL: true, PLAUSIBLE_SCRIPT_URL: true })
.merge(
z.object({
SITE_TITLE: z.string().min(1),
SITE_DESCRIPTION: z.string().min(1),
PAGE_SIZE_POST_CARD: z.number(),
PAGE_SIZE_POST_CARD_SMALL: z.number(),
MORE_POSTS_COUNT: z.number(),
DEFAULT_MODE: z.enum(modeValues), // check that theme and mode match
DEFAULT_THEME: z.enum(themeValues),
AUTHOR_NAME: z.string().min(1),
AUTHOR_EMAIL: z.string().email(),
AUTHOR_GITHUB: z.string().url(),
AUTHOR_LINKEDIN: z.string().url(),
AUTHOR_TWITTER: z.string().url(),
AUTHOR_YOUTUBE: z.string().url(),
REPO_URL: z.string().url(),
})
);

0 comments on commit 861cb67

Please sign in to comment.