Skip to content

Commit

Permalink
Avoid key file naming collision when running new and old codebase bac…
Browse files Browse the repository at this point in the history
…k and forth
  • Loading branch information
h2zh committed Dec 10, 2024
1 parent 007b7f1 commit 00b24c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/init_server_creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,9 @@ func migratePrivateKey(newDir string) error {
}

// Rename the existing private key file and set destination path
fileName := "migrated_key.pem"
fileName := fmt.Sprintf("migrated_%d_%s.pem",
time.Now().UnixNano(),
utils.CreateRandomString(4))
destPath := filepath.Join(newDir, fileName)

// Check if a file with the same name already exists in the destination
Expand Down

0 comments on commit 00b24c8

Please sign in to comment.