Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!