From cfa1b2e04d9056fe96981677bd856f7111ad9495 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 17 Jul 2024 13:48:42 -0400 Subject: [PATCH] Update vaultwarden.sh tweak --- ct/vaultwarden.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ct/vaultwarden.sh b/ct/vaultwarden.sh index 413cd5fa..f7901b79 100644 --- a/ct/vaultwarden.sh +++ b/ct/vaultwarden.sh @@ -127,9 +127,10 @@ function update_script() { if [[ -z "$NEWTOKEN" ]]; then exit; fi if ! command -v argon2 >/dev/null 2>&1; then apt-get install -y argon2 &>/dev/null; fi TOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -t 2 -m 16 -p 4 -l 64 -e) - for file in /opt/vaultwarden/.env /opt/vaultwarden/data/config.json; do - sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" "$file" - done + sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" /opt/vaultwarden/.env + if [[ -f /opt/vaultwarden/data/config.json ]]; then + sed -i "s|\"admin_token\":.*|\"admin_token\": \"${TOKEN}\"|" /opt/vaultwarden/data/config.json + fi systemctl restart vaultwarden fi exit