In my front end application, I'm storing sensitive information in the environment and using them as following:
const client_secret = process.env.CLIENT_SECRET;
On local development, I use dotenv package to pass in the values in .env
file
CLIENT_SECRET=XXXXX
The .env
file is not committed.
I use CircleCI for my deployment process, and saved the CLIENT_SECRET
value in CircleCI environment variables, but how can I pass into the application?
This is my CircleCI config.yml
:
- deploy:
name: Deploy
command: |
ENVIRONMENT=${ENVIRONMENT:=test}
VERSION=`date "+%Y-%m-%dt%H%M"`
if [ "${ENVIRONMENT}" = "production" ]; then
APP_FILE=app-prod.yaml
else
APP_FILE=app.yaml
fi
gcloud app deploy ${APP_FILE} --quiet --version ${VERSION}
I can do this in app.yaml
:
env_variables:
NODE_ENV: 'production'
CLIENT_SECRET: XXXXX
But I don't want to include the sensitive information into the .yaml
file and commit them. Does anyone know any way I can pass environment values into the application?
I'm using Google Cloud Platform, and
gcloud app deploy
command doesn't seem to have a flag to include the environment variables.