Created
July 25, 2017 19:19
-
-
Save dmvieira/0b46b2ba61c8541349e9d106e88bbbe8 to your computer and use it in GitHub Desktop.
Export gsenha keys function
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 | |
function export_gsenha_keys { | |
if [ "$GSENHA_ENDPOINT" == "" ] || [ "$GSENHA_USER" == "" ] || [ "$GSENHA_PASS" == "" ] || [ "$GSENHA_KEY$GSENHA_KEY_PATH" == "" ]; then | |
echo 'Missing GSENHA envs' | |
echo "GSENHA_ENDPOINT=$GSENHA_ENDPOINT" | |
echo "GSENHA_USER=$GSENHA_USER" | |
echo "GSENHA_PASS=$GSENHA_PASS" | |
echo "GSENHA_KEY=$GSENHA_KEY OR GSENHA_KEY_PATH=$GSENHA_KEY_PATH" | |
exit 1 | |
fi; | |
if hash gsenha 2>/dev/null; then | |
pass_export=$(gsenha get -f "$1" -n "$2") | |
else | |
echo "Download gsenha CLI: https://github.com/globocom/gsenha-cli/releases" | |
exit 1 | |
fi; | |
eval "$pass_export" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment