Skip to content

Commit

Permalink
Pull token within run
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-finley committed Mar 25, 2024
1 parent 6b47de2 commit 7df4a9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions process_file/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
mysql_config_str = os.environ["MYSQL_CONFIG"]
mysql_config_dict = json.loads(mysql_config_str)
secret_client = secretmanager.SecretManagerServiceClient()
dropbox_access_token = secret_client.access_secret_version(
name="projects/greg-finley/secrets/DROPBOX_ACCESS_TOKEN/versions/latest"
).payload.data.decode("utf-8")
dbx = dropbox.Dropbox(dropbox_access_token)


mysql_connection = mysql.connector.connect(
Expand All @@ -27,6 +23,10 @@


def run(event, context):
dropbox_access_token = secret_client.access_secret_version(
name="projects/greg-finley/secrets/DROPBOX_ACCESS_TOKEN/versions/latest"
).payload.data.decode("utf-8")
dbx = dropbox.Dropbox(dropbox_access_token)
filename = base64.b64decode(event["data"]).decode("utf-8")
print(f"Processing {filename}...")
dropbox_file = dbx.files_download("/" + filename)
Expand Down

0 comments on commit 7df4a9f

Please sign in to comment.