Making public environment variables more flexible? #9789
haleksandre
started this conversation in
Ideas
Replies: 0 comments
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.
-
Right now it's possible to expose environment variables via the
kit.env.publicPrefix
:string
on the front end. It only accepts astring
and it gets used as the argumentstartsWith()
here:kit/packages/kit/src/exports/vite/utils.js
Lines 61 to 64 in 8d1ba04
I'm wondering if it would be possible to also filter the environment variables with a regex. The string could technically be wrapped in something like this
Regex(`^${string}`)
to make it so the regex is still filtering as a prefix.Another option could be to have the ability to explicitly define an array of variable names that you wish to expose to the front end. Something like a safe list in the configuration
kit.env.safelist
:string[]
.Any option would work for my use case as I have a few projects that share the same variables across repositories used inside the projects & the CI/CD environments, etc.
Beta Was this translation helpful? Give feedback.
All reactions