Last active
January 3, 2024 20:30
-
-
Save zdk/11101f1a4172487b2ae5841500ae32e9 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
#!/bin/bash | |
set -e | |
SECRETS_MANAGER="aws secretsmanager" | |
REGION="ap-southeast-1" | |
function get_secret { | |
$($SECRETS_MANAGER get-secret-value --secret-id $secret --query SecretString --output text --region $REGION) | |
} | |
function parse_secret { | |
jq -r 'to_entries[] | "export \(.key)='\''\(.value)'\''"' | |
} | |
read -r -a secrets <<< "$SECRETS" | |
for secret in "${secrets[@]}" | |
do | |
export_vars=$(get_secret | parse_secret) | |
eval $export_vars | |
done | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@charltonstanley Congrats! Happy you got it working, lol. great stuff 😂