From 344590b19b4068d3aebfcbdd8b305270370e5e71 Mon Sep 17 00:00:00 2001 From: Rich M Date: Wed, 4 Oct 2023 19:07:08 +0100 Subject: [PATCH] Switch to using const for max docker secret length. --- cli/app/new.go | 4 ++-- pkg/config/env.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/app/new.go b/cli/app/new.go index 4c3d4243..e357a9f3 100644 --- a/cli/app/new.go +++ b/cli/app/new.go @@ -269,8 +269,8 @@ func ensureSecretLengths(secrets map[string]string, domainName string, sanitised domainAndFormatLength := len(sanitisedAppName) + 4 for secretName := range secrets { - if len(secretName)+domainAndFormatLength > 64 { - return fmt.Errorf("%s is too long (> 64 chars when combined with %s)", secretName, sanitisedAppName) + if len(secretName)+domainAndFormatLength > config.MAX_DOCKER_SECRET_LENGTH { + return fmt.Errorf("%s is too long (> %d chars when combined with %s)", secretName, config.MAX_DOCKER_SECRET_LENGTH, sanitisedAppName) } } diff --git a/pkg/config/env.go b/pkg/config/env.go index 98891880..c351b77f 100644 --- a/pkg/config/env.go +++ b/pkg/config/env.go @@ -35,6 +35,7 @@ var CATALOGUE_JSON_REPO_NAME = "recipes-catalogue-json" var SSH_URL_TEMPLATE = "ssh://git@git.coopcloud.tech:2222/coop-cloud/%s.git" const MAX_SANITISED_APP_NAME_LENGTH = 45 +const MAX_DOCKER_SECRET_LENGTH = 64 // GetServers retrieves all servers. func GetServers() ([]string, error) {