Skip to content

Commit

Permalink
hotfix: check if encryption is set for old agents
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Oct 24, 2023
1 parent 2844a5a commit 552f5db
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions machinery/src/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,12 @@ func SaveConfig(configDirectory string, config models.Config, configuration *mod
func StoreConfig(configDirectory string, config models.Config) error {

// Encryption key can be set wrong.
encryptionPrivateKey := config.Encryption.PrivateKey
// Replace \\n by \n
encryptionPrivateKey = strings.ReplaceAll(encryptionPrivateKey, "\\n", "\n")
config.Encryption.PrivateKey = encryptionPrivateKey
if config.Encryption != nil {
encryptionPrivateKey := config.Encryption.PrivateKey
// Replace \\n by \n
encryptionPrivateKey = strings.ReplaceAll(encryptionPrivateKey, "\\n", "\n")
config.Encryption.PrivateKey = encryptionPrivateKey
}

// Save into database
if os.Getenv("DEPLOYMENT") == "factory" || os.Getenv("MACHINERY_ENVIRONMENT") == "kubernetes" {
Expand Down

0 comments on commit 552f5db

Please sign in to comment.