1

I am using Vite setup for my react application. Although I am using the environment variables in workflows file as docker arguments like this while building the image -

 docker-args: "--build-arg VITE_TOKEN=xyz
               --build-arg VITE_API_URL=localhost:8080"

It is working just fine when deployed on environment.

What I felt that while building the docker image, these environment added up into the image itself. While I am using Helm Chart(values.yaml)

env:
  VITE_TOKEN: "token"
  VITE_API_URL: "https://app.dev.org.io"

and I am trying to add the environment variables in values.yaml, these variables are not being replaced in my application.

Is there any way I can replace environment variables from values.yaml to the react vite application ?

2
  • No, those are set at build time. I've explained the problem and some of the alternatives on my blog: blog.jonrshar.pe/2020/Sep/19/spa-config.html Commented Apr 16, 2024 at 17:20
  • Just wanted to write that your post helped me fix my setup for React running on IIS. Thanks! Commented Jul 3, 2024 at 12:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.