mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-13 23:54:03 +00:00
feat: add timestamp to token names for true uniqueness
Token names now include both Pulse server IP and Unix timestamp (e.g. pulse-192-168-0-176-1754816525) ensuring each script run creates a unique token. This completely eliminates 'token already exists' errors when running setup scripts multiple times.
This commit is contained in:
parent
5a98e05cb0
commit
1da7ca4ea7
1 changed files with 6 additions and 3 deletions
|
|
@ -1573,15 +1573,18 @@ func (h *ConfigHandlers) HandleSetupScript(w http.ResponseWriter, r *http.Reques
|
|||
}
|
||||
}
|
||||
|
||||
// Create unique token name based on Pulse IP
|
||||
tokenName := fmt.Sprintf("pulse-%s", pulseIP)
|
||||
// Create unique token name based on Pulse IP and timestamp
|
||||
// Adding timestamp ensures truly unique tokens even when running from same Pulse server
|
||||
timestamp := time.Now().Unix()
|
||||
tokenName := fmt.Sprintf("pulse-%s-%d", pulseIP, timestamp)
|
||||
|
||||
// Log the token name for debugging
|
||||
log.Info().
|
||||
Str("pulseURL", pulseURL).
|
||||
Str("pulseIP", pulseIP).
|
||||
Str("tokenName", tokenName).
|
||||
Msg("Generated token name for setup script")
|
||||
Int64("timestamp", timestamp).
|
||||
Msg("Generated unique token name for setup script")
|
||||
|
||||
var script string
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue