Created
May 23, 2019 18:32
-
-
Save akiatoji/0223d293a71b922b68ad1d8f525b6efb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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