From 2583fe2861ba0700aaf7fc3ed5b0cbf934c0921c Mon Sep 17 00:00:00 2001 From: Rich M Date: Wed, 4 Oct 2023 18:51:13 +0100 Subject: [PATCH] Drop debug logging and fail on first secret that is too long. --- cli/app/new.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/cli/app/new.go b/cli/app/new.go index c31583ca..7a3d6970 100644 --- a/cli/app/new.go +++ b/cli/app/new.go @@ -2,7 +2,6 @@ package app import ( "fmt" - "strings" "coopcloud.tech/abra/cli/internal" "coopcloud.tech/abra/pkg/autocomplete" @@ -268,29 +267,12 @@ func ensureSecretLengths(secrets map[string]string, domainName string, sanitised } domainAndFormatLength := len(sanitisedAppName) + 4 - failingSecrets := []string{} - maxSecretLength := 0 - for secretName := range secrets { - if len(secretName) > maxSecretLength { - maxSecretLength = len(secretName) - } - if len(secretName)+domainAndFormatLength > 64 { - failingSecrets = append(failingSecrets, secretName) + return fmt.Errorf("%s is too long (> 64 chars when combined with %s)", secretName, sanitisedAppName) } } - if len(failingSecrets) > 0 { - failedSecretsString := strings.Join(failingSecrets, ", ") - return fmt.Errorf("the following secrets are too long to work with the domain name %s\n change their length or use a shorter domain name:\n %s", domainName, failedSecretsString) - } - - logrus.Debugf( - `The longest secret name is %d -including 4 extra characters for format %s__v1 -fits with domain length of %d for max docker secret length of %d`, - maxSecretLength, sanitisedAppName, domainAndFormatLength, domainAndFormatLength+maxSecretLength) return nil }