Get env in front extension

How can I get envs in a front-end extension in directus?

1 Answer

1

Frontend extensions run in the browser and environment variables exist on the server. The browser cannot directly access environment variables from the server, you’ll have to expose the data you want through the API so the browser can request it.

Isn't there a way to pass envs to the frontend and make them public? For example, by using a PUBLIC_ or VITE_ prefix?

That doesn't natively exist today no, but that sounds like a great feature request. Mind shooting that in on roadmap.directus.io so we can track it as such? Thanks!