fix
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
apk add jq curl
|
||||
|
||||
VAULT_HOST=http://0.0.0.0:8200
|
||||
|
||||
root_token=$(cat /helpers/keys.json | jq -r '.root_token')
|
||||
VAULT_HOST=http://127.0.0.1:8200
|
||||
|
||||
unseal_vault() {
|
||||
export VAULT_TOKEN=$root_token
|
||||
root_token=$(cat /helpers/keys.json | jq -r '.root_token')
|
||||
|
||||
vault operator unseal -address=${VAULT_HOST} $(cat /helpers/keys.json | jq -r '.keys[0]')
|
||||
vault login token=$VAULT_TOKEN
|
||||
vault login token=$root_token
|
||||
}
|
||||
|
||||
if [[ -n "$root_token" ]]
|
||||
if [[ -f /helpers/keys.json ]]
|
||||
then
|
||||
echo "Vault already initialized"
|
||||
unseal_vault
|
||||
else
|
||||
echo "Vault not initialized"
|
||||
curl -s --request POST --data '{"secret_shares": 1, "secret_threshold": 1}' ${VAULT_HOST}/v1/sys/init > /helpers/keys.json
|
||||
root_token=$(cat /helpers/keys.json | jq -r '.root_token')
|
||||
|
||||
unseal_vault
|
||||
|
||||
|
Reference in New Issue
Block a user