Custom command to generate passwords

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

5
abra
View File

@ -11,7 +11,7 @@ sub_help(){
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 " 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 ""
@ -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)
}