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

159
Views
Problem with import gcp secrets with node

I´m using gcp secrets manager (cloud service), and in my code I use the package @google-cloud/secret-manager to get them.

like this:

  const [version] = await client.accessSecretVersion({
    name: name_here
  })

    const responsePayload = Dotenv.parse(version?.payload?.data.toString());

    await this.setDatabase(responsePayload)

Well after that I use this functions setDatabase to put this payload on a config object, that I created more above in the code.

The problems is that, in other scripts, is imported this config object before the load of the setDatabase() in order to connect knex with dabatase, but in time of load the imports the config object is still blank.

Maybe somes pics will clarify:

config File

import in other script

console.log of config.database before loaded

console.log of config in other moment after loaded

Anyone has a tip for it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

well I would put all of your initialization tasks into one place, and do them in the sequence you want, so there isn't a cross dependency between common includes. It will give you a cleaner result when your init code is isolated like this.

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