Custom command to generate passwords
continuous-integration/drone/push Build is passing Details

This commit is contained in:
3wc 2020-09-08 20:10:37 +02:00
parent 73768b8014
commit 86785b6aea
1 changed files with 6 additions and 5 deletions

11
abra
View File

@ -10,10 +10,10 @@ sub_help(){
echo "Usage: $PROGRAM_NAME <subcommand> [options]"
echo ""
echo "Subcommands:"
echo " service_run SERVICE [CMD] run a command in the specified service's container"
echo " secret_generate SECRET VERSION generate a secret, store it in pass & as a Docker secret"
echo " deploy [COMPOSE_FILE] let 'em rip"
echo " logs SERVICE tail logs from a deployed service"
echo " service_run SERVICE [CMD] run a command in the specified service's container"
echo " secret_generate SECRET VERSION [CMD] generate a secret, store it in pass & as a Docker secret"
echo " deploy [COMPOSE_FILE] let 'em rip"
echo " logs SERVICE tail logs from a deployed service"
echo ""
echo "Make sure \$STACK_NAME is set (probably using direnv)"
}
@ -21,13 +21,14 @@ sub_help(){
sub_secret_generate(){
SECRET=$1
VERSION=$2
PW=${3:-pwqgen}
if [ -z "$SECRET" ] || [ -z "$VERSION" ]; then
echo "Usage: $PROGRAM_NAME secret_generate SECRET VERSION"
exit
fi
pwqgen | tee \
$PW | tee \
>(docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" -) \
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
}