Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

376
Vistas
How do I read a docker environment variable within a js script?

I have a react app hosted on a node docker container. I run it and pass it an environment variable

 docker run -t -e "ADMIN_HOST_ENV=http://myapp.app:443/api" -p 3000:3000 "myapp"

How can I get that "ADMIN_HOST_ENV" environment variable within the app?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If this is just about the node backend, there's already a question with a answer: Read environment variables in Node.js

On the frontend, you'll have several options to get at it, create an endpoint to get it, write it to a .js file that's referenced by the frontend, pass it up as a cookie, keep it backend side and only reference it when you hit the backend, etc.

I check environment variables when I run my server, write them to an environment.js, and then reference that environment.js in my index.html.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda