Skip to content

Commit

Permalink
omit plausible url from server schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjam committed Aug 28, 2024
1 parent 011e609 commit 899d019
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/working-notes/my-old-code/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.refine(
(data) => {
if (data.NODE_ENV === 'production') return Boolean(data.PLAUSIBLE_SCRIPT_URL);
return true;
},
{
message: 'PLAUSIBLE_SCRIPT_URL is required in production',
path: ['PLAUSIBLE_SCRIPT_URL'],
}
);
1 change: 1 addition & 0 deletions docs/working-notes/todo3.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,5 +530,6 @@ folder name for slug and index.mdx and images
// plausible
<script defer data-domain="nemanjamitic.com" src="https://plausible.arm1.nemanjamitic.com/js/script.js"></script>
add zod schema that checks node_env for plausible_url instead of optional
moze samo za 1 url data-domain="nemanjamitic.com"
------------
```
2 changes: 1 addition & 1 deletion src/schemas/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const processEnvSchema = z.object({
});

export const configServerSchema = processEnvSchema
.omit({ SITE_URL: true, PREVIEW_MODE: true })
.omit({ SITE_URL: true, PREVIEW_MODE: true, PLAUSIBLE_SCRIPT_URL: true })
.extend({ PREVIEW_MODE: z.boolean() }); // here its boolean, not 'true' | 'false'

export const configClientSchema = processEnvSchema
Expand Down

0 comments on commit 899d019

Please sign in to comment.