Skip to content

Commit 5b97ce9

Browse files
committed
Add deployment script mpcium
1 parent 8f244d3 commit 5b97ce9

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

deployment_script.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# Function to decrypt secrets
4+
decrypt_secret() {
5+
gpg --pinentry-mode loopback --passphrase "$1" -d "$2" 2>/dev/null
6+
}
7+
8+
# Prompt for PASS value
9+
read -sp "Enter the PASS value: " PASS
10+
echo
11+
12+
# Set up environment variables
13+
export GPG_TTY=$(tty)
14+
15+
# Decrypt secrets
16+
NATS_PASSWORD=$(decrypt_secret "$PASS" ~/.password-store/apex-nats-password.gpg)
17+
CONSUL_PASSWORD=$(decrypt_secret "$PASS" ~/.password-store/apex-consul-password.gpg)
18+
CONSUL_TOKEN=$(decrypt_secret "$PASS" ~/.password-store/apex-consul-token.gpg)
19+
BADGER_PASSWORD=$(decrypt_secret "$PASS" ~/.password-store/mpcium-badger-password.gpg)
20+
21+
# Prompt for command
22+
read -p "Enter the command to execute: " user_command
23+
24+
# Execute the command with environment variables
25+
env NATS_PASSWORD="$NATS_PASSWORD" \
26+
CONSUL_PASSWORD="$CONSUL_PASSWORD" \
27+
CONSUL_TOKEN="$CONSUL_TOKEN" \
28+
BADGER_PASSWORD="$BADGER_PASSWORD" \
29+
ENVIRONMENT=production \
30+
$user_command
31+
32+
# Clear sensitive variables
33+
unset PASS NATS_PASSWORD CONSUL_PASSWORD CONSUL_TOKEN BADGER_PASSWORD

0 commit comments

Comments
 (0)