Skip to content

Instantly share code, notes, and snippets.

View rxhl's full-sized avatar
❄️
Handmade Heaven

Rahul Sharma rxhl

❄️
Handmade Heaven
View GitHub Profile
gcloud secrets create django_app_settings --replication-policy automatic
gcloud secrets versions add django_app_settings --data-file .env.prod
# Get the PROJECTNUM from your GCP project dashboard
gcloud secrets add-iam-policy-binding django_app_settings \
--member serviceAccount:<PROJECTNUM>@cloudbuild.gserviceaccount.com \
--role roles/secretmanager.secretAccessor
gcloud secrets describe django_app_settings
# Update the settings.py file to use our newly created env variables.
import io
import os
import environ
import google.auth
from google.cloud import secretmanager
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
steps:
# 0. Docker Build
- name: gcr.io/cloud-builders/docker
args:
- build
- '--no-cache'
- '-t'
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- .
- '-f'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.