Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda