Replies: 1 comment 1 reply
-
You could use the public env module https://kit.svelte.dev/docs/modules#$env-dynamic-public |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I understand the leak risks of private/secret env vars, but I have a use case of creating an amorphous client that can work like
someClient.getSomeResource('sdf')
with the implementation detail ofsomeClient
being different on SSR vs CSR. (SSR using secret key, CSR using client key).I have the file implemented like so:
someClient.ts
and i consume the file in both
+layout.server.ts
(works fine here, as it's server render only) and+layout.ts
(fails here with the below error).Cannot import $lib/server/env.secrets.ts into client-side code:
What would be folk's suggestion here to get around this?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions