feat: inject legacy API token during migration
This commit is contained in:
parent
32967b3658
commit
43f09f76bc
1 changed files with 9 additions and 0 deletions
|
|
@ -142,6 +142,15 @@ echo "$LEGACY_PRIVATE_KEY" > "$WG_SERVER_KEY"
|
|||
echo "$LEGACY_PUBLIC_KEY" > "$WG_SERVER_PUB"
|
||||
ok "Private key written to server keyfile."
|
||||
|
||||
# ─── INJECT API TOKEN ────────────────────────────────────────────────────────
|
||||
sep
|
||||
info "Injecting legacy API token..."
|
||||
LEGACY_API_TOKEN=$(grep -E '^API_TOKEN=' "$BACKUP_DIR/legacy.env" | cut -d= -f2 | tr -d '[:space:]')
|
||||
[ -z "$LEGACY_API_TOKEN" ] && warn "No legacy API token found, keeping generated one." || {
|
||||
sed -i "s|^OPERATOR_API_TOKEN=.*|OPERATOR_API_TOKEN=$LEGACY_API_TOKEN|" "$OPERATOR_DIR/.env"
|
||||
ok "API token injected from legacy."
|
||||
}
|
||||
|
||||
# ─── START NEW WIREGUARD ──────────────────────────────────────────────────────
|
||||
sep
|
||||
info "Starting new WireGuard with legacy identity..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue