Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import os
import uuid
from google.cloud import storage, kms_v1
def load(app):
config_file_name = "secrets-%s.cfg" % str(uuid.uuid4())
storage_client = storage.Client()
bucket = storage_client.get_bucket('vault')
blob = bucket.blob('secrets.cfg')
blob.download_to_filename(config_file_name)
try:
app.config.from_pyfile(config_file_name)
finally:
os.remove(config_file_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.