Skip to content

Commit

Permalink
fix env expansion for secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Glonek committed Jul 23, 2024
1 parent d3c568d commit 67f9cc5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/cmdAgi.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,19 @@ func (c *agiRetriggerCmd) Execute(args []string) error {
return nil
}
if c.SftpUser != nil && strings.HasPrefix(*c.SftpUser, "ENV::") {
aa := os.ExpandEnv(strings.Split(*c.SftpUser, "::")[1])
aa := os.Getenv(strings.Split(*c.SftpUser, "::")[1])
c.SftpUser = &aa
}
if c.SftpPass != nil && strings.HasPrefix(*c.SftpPass, "ENV::") {
aa := os.ExpandEnv(strings.Split(*c.SftpPass, "::")[1])
aa := os.Getenv(strings.Split(*c.SftpPass, "::")[1])
c.SftpPass = &aa
}
if c.S3KeyID != nil && strings.HasPrefix(*c.S3KeyID, "ENV::") {
aa := os.ExpandEnv(strings.Split(*c.S3KeyID, "::")[1])
aa := os.Getenv(strings.Split(*c.S3KeyID, "::")[1])
c.S3KeyID = &aa
}
if c.S3Secret != nil && strings.HasPrefix(*c.S3Secret, "ENV::") {
aa := os.ExpandEnv(strings.Split(*c.S3Secret, "::")[1])
aa := os.Getenv(strings.Split(*c.S3Secret, "::")[1])
c.S3Secret = &aa
}
if c.S3Enable != nil && *c.S3Enable && c.S3path != nil && *c.S3path == "" {
Expand Down
10 changes: 5 additions & 5 deletions src/cmdAgiCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@ func (c *agiCreateCmd) Execute(args []string) error {
return nil
}
if strings.HasPrefix(c.SlackToken, "ENV::") {
c.SlackToken = os.ExpandEnv(strings.Split(c.SlackToken, "::")[1])
c.SlackToken = os.Getenv(strings.Split(c.SlackToken, "::")[1])
}
if strings.HasPrefix(c.SftpUser, "ENV::") {
c.SftpUser = os.ExpandEnv(strings.Split(c.SftpUser, "::")[1])
c.SftpUser = os.Getenv(strings.Split(c.SftpUser, "::")[1])
}
if strings.HasPrefix(c.SftpPass, "ENV::") {
c.SftpPass = os.ExpandEnv(strings.Split(c.SftpPass, "::")[1])
c.SftpPass = os.Getenv(strings.Split(c.SftpPass, "::")[1])
}
if strings.HasPrefix(c.S3KeyID, "ENV::") {
c.S3KeyID = os.ExpandEnv(strings.Split(c.S3KeyID, "::")[1])
c.S3KeyID = os.Getenv(strings.Split(c.S3KeyID, "::")[1])
}
if strings.HasPrefix(c.S3Secret, "ENV::") {
c.S3Secret = os.ExpandEnv(strings.Split(c.S3Secret, "::")[1])
c.S3Secret = os.Getenv(strings.Split(c.S3Secret, "::")[1])
}
if c.ClusterName == "~auto~" {
c.ClusterName = TypeClusterName(shortuuid.New())
Expand Down
4 changes: 2 additions & 2 deletions src/cmdClientDoEksctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func (c *clientCreateEksCtlCmd) Execute(args []string) error {
return nil
}
if strings.HasPrefix(c.EksAwsKeyId, "ENV::") {
c.EksAwsKeyId = os.ExpandEnv(strings.Split(c.EksAwsKeyId, "::")[1])
c.EksAwsKeyId = os.Getenv(strings.Split(c.EksAwsKeyId, "::")[1])
}
if strings.HasPrefix(c.EksAwsSecretKey, "ENV::") {
c.EksAwsSecretKey = os.ExpandEnv(strings.Split(c.EksAwsSecretKey, "::")[1])
c.EksAwsSecretKey = os.Getenv(strings.Split(c.EksAwsSecretKey, "::")[1])
}
script := scripts.GetEksctlBootstrapScript()
if c.InstallYamls {
Expand Down

0 comments on commit 67f9cc5

Please sign in to comment.