From 868ab217a57aaac289c24c3d939e97825ac5f8af Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 19 Aug 2025 00:09:18 +0200 Subject: [PATCH] feat: handle generate=false env var mod See https://git.coopcloud.tech/toolshed/organising/issues/461 --- pkg/secret/secret.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/secret/secret.go b/pkg/secret/secret.go index 2d03772f..287ec292 100644 --- a/pkg/secret/secret.go +++ b/pkg/secret/secret.go @@ -37,6 +37,9 @@ type Secret struct { // variable. For Example: // SECRET_FOO=v1 # charset=default,special Charset string + // Whether or not to skip generation of the secret or not + // For example: SECRET_FOO=v1 # generate=false + SkipGenerate bool // RemoteName is the name of the secret on the server. For example: // name: ${STACK_NAME}_test_pass_two_${SECRET_TEST_PASS_TWO_VERSION} // With the following: @@ -155,6 +158,13 @@ func ReadSecretsConfig(appEnvPath string, composeFiles []string, stackName strin value.Length = length } + generateRaw, ok := modifierValues["generate"] + if ok { + if generateRaw == "true" { + value.SkipGenerate = true + } + } + value.Charset = resolveCharset(modifierValues["charset"]) break } @@ -192,6 +202,12 @@ func GenerateSecrets(cl *dockerClient.Client, secrets map[string]Secret, server go func(secretName string, secret Secret) { defer wg.Done() + if secret.SkipGenerate { + log.Debugf("skipping generation of %s (generate=false)", secretName) + ch <- nil + return + } + log.Debugf("attempting to generate and store %s on %s", secret.RemoteName, server) if secret.Length > 0 {