Skip to content

Loading secrets as environment variables (needed in staging/production environments)

Santiago Faci requested to merge secrets-as-env-variables into main

Loading secrets as environment variables (needed in staging/production environments)

Kubernetes serves secrets as environment variables, so we should load them from there instead of from the config file. So far we have our database and sal passwords and the client_secret for SSO that will be DATABASE_PASSWORD, SAL_PASSWORD AND IDP_CLIENT_SECRET env variables when running in staging/production environment, respectively.

I have kept the previous values in the config values we use to develop locally because k8s generates a new config file in staging/production environment so we can use these locally while working on the service.

Anyway, to check that this change works we can run the service locally this way:

DATABASE_PASSWORD=maria SAL_PASSWORD=Test1234 IDP_CLIENT_SECRET=Test1234 node server.js --config config.local.yaml

Edited by Santiago Faci

Merge request reports