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

161
Vistas
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 Respuestas
Responde la pregunta

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 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