forked from toolshed/abra-bash
Custom command to generate passwords
This commit is contained in:
parent
73768b8014
commit
86785b6aea
11
abra
11
abra
@ -10,10 +10,10 @@ sub_help(){
|
|||||||
echo "Usage: $PROGRAM_NAME <subcommand> [options]"
|
echo "Usage: $PROGRAM_NAME <subcommand> [options]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Subcommands:"
|
echo "Subcommands:"
|
||||||
echo " service_run SERVICE [CMD] run a command in the specified service's container"
|
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 " secret_generate SECRET VERSION [CMD] generate a secret, store it in pass & as a Docker secret"
|
||||||
echo " deploy [COMPOSE_FILE] let 'em rip"
|
echo " deploy [COMPOSE_FILE] let 'em rip"
|
||||||
echo " logs SERVICE tail logs from a deployed service"
|
echo " logs SERVICE tail logs from a deployed service"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Make sure \$STACK_NAME is set (probably using direnv)"
|
echo "Make sure \$STACK_NAME is set (probably using direnv)"
|
||||||
}
|
}
|
||||||
@ -21,13 +21,14 @@ sub_help(){
|
|||||||
sub_secret_generate(){
|
sub_secret_generate(){
|
||||||
SECRET=$1
|
SECRET=$1
|
||||||
VERSION=$2
|
VERSION=$2
|
||||||
|
PW=${3:-pwqgen}
|
||||||
|
|
||||||
if [ -z "$SECRET" ] || [ -z "$VERSION" ]; then
|
if [ -z "$SECRET" ] || [ -z "$VERSION" ]; then
|
||||||
echo "Usage: $PROGRAM_NAME secret_generate SECRET VERSION"
|
echo "Usage: $PROGRAM_NAME secret_generate SECRET VERSION"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pwqgen | tee \
|
$PW | tee \
|
||||||
>(docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" -) \
|
>(docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" -) \
|
||||||
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
|
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user