chore: clean cruft / formatting / add whitespace
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -11,11 +11,6 @@ import (
|
|||||||
"git.coopcloud.tech/toolshed/godotenv"
|
"git.coopcloud.tech/toolshed/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// envVarModifiers is a list of env var modifier strings. These are added to
|
|
||||||
// env vars as comments and modify their processing by Abra, e.g. determining
|
|
||||||
// how long secrets should be.
|
|
||||||
var envVarModifiers = []string{"length"}
|
|
||||||
|
|
||||||
// AppEnv is a map of the values in an apps env config
|
// AppEnv is a map of the values in an apps env config
|
||||||
type AppEnv = map[string]string
|
type AppEnv = map[string]string
|
||||||
|
|
||||||
|
@ -52,11 +52,7 @@ type Secret struct {
|
|||||||
|
|
||||||
// GeneratePassword generates passwords.
|
// GeneratePassword generates passwords.
|
||||||
func GeneratePassword(length uint, charset string) (string, error) {
|
func GeneratePassword(length uint, charset string) (string, error) {
|
||||||
passwords, err := passgen.GeneratePasswords(
|
passwords, err := passgen.GeneratePasswords(1, length, charset)
|
||||||
1,
|
|
||||||
length,
|
|
||||||
charset,
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -94,6 +90,7 @@ func ReadSecretsConfig(appEnvPath string, composeFiles []string, stackName strin
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the STACK_NAME to be able to generate the remote name correctly.
|
// Set the STACK_NAME to be able to generate the remote name correctly.
|
||||||
appEnv["STACK_NAME"] = stackName
|
appEnv["STACK_NAME"] = stackName
|
||||||
|
|
||||||
@ -102,6 +99,7 @@ func ReadSecretsConfig(appEnvPath string, composeFiles []string, stackName strin
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the compose files without injecting environment variables.
|
// Read the compose files without injecting environment variables.
|
||||||
configWithoutEnv, err := loader.LoadComposefile(opts, map[string]string{}, loader.SkipInterpolation)
|
configWithoutEnv, err := loader.LoadComposefile(opts, map[string]string{}, loader.SkipInterpolation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -149,6 +147,7 @@ func ReadSecretsConfig(appEnvPath string, composeFiles []string, stackName strin
|
|||||||
if !strings.Contains(configWithoutEnv.Secrets[secretId].Name, envName) {
|
if !strings.Contains(configWithoutEnv.Secrets[secretId].Name, envName) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
lengthRaw, ok := modifierValues["length"]
|
lengthRaw, ok := modifierValues["length"]
|
||||||
if ok {
|
if ok {
|
||||||
length, err := strconv.Atoi(lengthRaw)
|
length, err := strconv.Atoi(lengthRaw)
|
||||||
|
Reference in New Issue
Block a user