Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions deployment/get_env_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Make cURL request to retrieve JSON response
response=$(curl "https://secretmanager.googleapis.com/v1/projects/protocol-labs-data/secrets/LILY_ENV_FILE/versions/latest:access" \
--request "GET" \
--header "authorization: Bearer $(gcloud auth print-access-token)" \
--header "content-type: application/json")

# Extract the `.payload.data` field from the response JSON
data=$(echo $response | jq -r '.payload.data')
Comment on lines +4 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
response=$(curl "https://secretmanager.googleapis.com/v1/projects/protocol-labs-data/secrets/LILY_ENV_FILE/versions/latest:access" \
--request "GET" \
--header "authorization: Bearer $(gcloud auth print-access-token)" \
--header "content-type: application/json")
# Extract the `.payload.data` field from the response JSON
data=$(echo $response | jq -r '.payload.data')
response=$(curl "https://secretmanager.googleapis.com/v1/projects/protocol-labs-data/secrets/LILY_ENV_FILE/versions/latest:access" \
--request "GET" \
--header "authorization: Bearer $(gcloud auth print-access-token)" \
--header "content-type: application/json" | jq -r '.payload.data')

to make it simpler


# Decode the `data` field using base64
echo $data | base64 -d > .env