0

I am trying to access it as recommended here: https://vitejs.dev/guide/env-and-mode.html#:~:text=console.log(import.meta.env.VITE_SOME_KEY)%20//%20123

The problem is how do I pass Environment variables to VITE after the container image is built?

I tried creating Variables like:

APP_API_KEY and assign a value to it.

On my code, I try to call it with import.meta.env.APP_API_KEY

But all I get is undefined.

tried to follow this https://stackoverflow.com/questions/72705471/how-to-reference-secrets-in-azure-container-apps?rq=1#:~:text=let%20db_password%20%3D%20process.env.DB_PASSWORD%3B

But it didn't work.

1 Answers1

0

prefix with VITE_

vite env-variable docs

DominicSeel
  • 322
  • 4
  • 10
  • That would work during BUILD, but not after - as these are simply read from the environment and then injected into dist – zaitsman Jun 01 '23 at 22:48