From 552f5dbea6be3a618ad99887eff609341785f1d0 Mon Sep 17 00:00:00 2001 From: Cedric Verstraeten Date: Tue, 24 Oct 2023 17:52:09 +0200 Subject: [PATCH] hotfix: check if encryption is set for old agents --- machinery/src/config/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/machinery/src/config/main.go b/machinery/src/config/main.go index 5a97a83..14c0814 100644 --- a/machinery/src/config/main.go +++ b/machinery/src/config/main.go @@ -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" {