Custom command to generate passwords
This commit is contained in:
		
							
								
								
									
										11
									
								
								abra
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								abra
									
									
									
									
									
								
							| @ -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) | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user