fix: collect local name also

This commit is contained in:
2025-09-29 10:33:04 +02:00
parent dee2d9d104
commit f468bc7443

View File

@ -50,6 +50,11 @@ type Secret struct {
// Will have this remote name: // Will have this remote name:
// test_example_com_test_pass_two_v2 // test_example_com_test_pass_two_v2
RemoteName string RemoteName string
// LocalName iis the name of the secret in the recipe config. This is also
// the name that you pass to `abra app secret insert` and is shown on `abra
// app secret list`
LocalName string
} }
// GeneratePassword generates passwords. // GeneratePassword generates passwords.
@ -133,7 +138,12 @@ func ReadSecretsConfig(appEnvPath string, composeFiles []string, stackName strin
lastIdx := strings.LastIndex(secretConfig.Name, "_") lastIdx := strings.LastIndex(secretConfig.Name, "_")
secretVersion := secretConfig.Name[lastIdx+1:] secretVersion := secretConfig.Name[lastIdx+1:]
value := Secret{Version: secretVersion, RemoteName: secretConfig.Name}
value := Secret{
Version: secretVersion,
RemoteName: secretConfig.Name,
LocalName: secretId,
}
if len(value.RemoteName) > config.MAX_DOCKER_SECRET_LENGTH { if len(value.RemoteName) > config.MAX_DOCKER_SECRET_LENGTH {
return nil, errors.New(i18n.G("secret %s is > %d chars when combined with %s", secretId, config.MAX_DOCKER_SECRET_LENGTH, stackName)) return nil, errors.New(i18n.G("secret %s is > %d chars when combined with %s", secretId, config.MAX_DOCKER_SECRET_LENGTH, stackName))