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

190
Vistas
Node JS loading secrets on a "pre" task and updating the environment variables for the main task

I have many services written in Node and loading secrets on startup has always been a problem for me.

I believe that when a service starts up, it should have every piece of configuration/secret ready for it beforehand.

  • Static configurations are easy (environment variables, usually via .env file).
  • Secrets? More complex if the infra hosting you doesn't support that.

Luckily, I've found that in Node, whatever script we add to the package.json file can have pre and/or post scripts as well. So it comes in very handy, as I can:

  1. have a reusable code that loaded secrets from somewhere
  2. persists the values in the environment variables
  3. before starting up the main script

The difficulty is that I'm unable to persist environment variables and have them available on the next process.

I wonder if that's a limitation (in Linux) or there's some way that I have missed.

Writing the secrets to a file to be read by the main process is unacceptable.

about 4 years ago · Juan Pablo Isaza
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