Last active
March 22, 2022 15:21
-
-
Save jsierles/fa7208e07decc59a37ac789d2fb505aa to your computer and use it in GitHub Desktop.
Clone Fly app secrets
This file contains 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/sh | |
# | |
# Clone secrets from one Fly app to another | |
TEMPFILE=`mktemp` | |
trap "rm -rf $TEMPFILE" EXIT | |
SECRET_KEYS=`fly secrets list -a $1 | tail -n +2 | cut -f1 -d" "` | |
fly ssh console -a $1 -C env | tr -d '\r' > $TEMPFILE | |
for key in $SECRET_KEYS; do | |
PATTERN="${PATTERN}\|${key}" | |
done | |
grep $PATTERN $TEMPFILE | fly secrets import -a $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment