Using _post function

This commit is contained in:
Sergey Pashinin 2020-08-24 00:05:21 +03:00
parent de692d3dcc
commit f511a52705
No known key found for this signature in database
GPG Key ID: 3C0D84EA2D933E47

View File

@ -49,14 +49,15 @@ vault_deploy() {
_cfullchain=$(sed -z 's/\n/\\n/g' <"$5") _cfullchain=$(sed -z 's/\n/\\n/g' <"$5")
URL="$VAULT_ADDR/v1/$VAULT_PREFIX/$_cdomain" URL="$VAULT_ADDR/v1/$VAULT_PREFIX/$_cdomain"
export _H1="X-Vault-Token: $VAULT_TOKEN"
if [ -n "$FABIO" ]; then if [ -n "$FABIO" ]; then
curl --silent -H "X-Vault-Token: $VAULT_TOKEN" --request POST --data "{\"cert\": \"$_cfullchain\", \"key\": \"$_ckey\"}" "$URL" || return 1 _post "{\"cert\": \"$_cfullchain\", \"key\": \"$_ckey\"}" "$URL"
else else
curl --silent -H "X-Vault-Token: $VAULT_TOKEN" --request POST --data "{\"value\": \"$_ccert\"}" "$URL/cert.pem" || return 1 _post "{\"value\": \"$_ccert\"}" "$URL/cert.pem"
curl --silent -H "X-Vault-Token: $VAULT_TOKEN" --request POST --data "{\"value\": \"$_ckey\"}" "$URL/cert.key" || return 1 _post "{\"value\": \"$_ckey\"}" "$URL/cert.key"
curl --silent -H "X-Vault-Token: $VAULT_TOKEN" --request POST --data "{\"value\": \"$_cca\"}" "$URL/chain.pem" || return 1 _post "{\"value\": \"$_cca\"}" "$URL/chain.pem"
curl --silent -H "X-Vault-Token: $VAULT_TOKEN" --request POST --data "{\"value\": \"$_cfullchain\"}" "$URL/fullchain.pem" || return 1 _post "{\"value\": \"$_cfullchain\"}" "$URL/fullchain.pem"
fi fi
} }