Skip to content

Instantly share code, notes, and snippets.

@jsierles
Last active March 22, 2022 15:21
Show Gist options
  • Save jsierles/fa7208e07decc59a37ac789d2fb505aa to your computer and use it in GitHub Desktop.
Save jsierles/fa7208e07decc59a37ac789d2fb505aa to your computer and use it in GitHub Desktop.
Clone Fly app secrets
#!/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