feat: directly put values into pipeline
This commit is contained in:
parent
a76a1220de
commit
c26db1d567
6 changed files with 3807 additions and 33 deletions
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/hashicorp/vault-client-go"
|
||||
)
|
||||
|
||||
func (s *SecretsManager) GetSecrets(cfg config.Config) ([]string, error) {
|
||||
func (s *SecretsManager) GetSecrets(cfg config.Config) (map[string]interface{}, error) {
|
||||
config.InfoLog("Attempting to read secret from mount '%s' at path '%s'", cfg.VaultSecretsManagerID, cfg.VaultPath)
|
||||
secret, err := s.Client.Secrets.KvV2Read(s.Ctx, cfg.VaultPath, vault.WithMountPath(cfg.VaultSecretsManagerID))
|
||||
if err != nil {
|
||||
|
|
@ -15,16 +15,16 @@ func (s *SecretsManager) GetSecrets(cfg config.Config) ([]string, error) {
|
|||
}
|
||||
|
||||
if secret == nil || secret.Data.Data == nil {
|
||||
return []string{}, fmt.Errorf("no data found at the specified secret path")
|
||||
return nil, fmt.Errorf("no data found at the specified secret path")
|
||||
}
|
||||
|
||||
var secretsAsKeyValue []string
|
||||
//var secretsAsKeyValue []string
|
||||
//for key, value := range secret.Data.Data {
|
||||
// secretsAsKeyValue = append(secretsAsKeyValue, fmt.Sprintf("%s=%v", key, value))
|
||||
//}
|
||||
//config.InfoLog("Successfully retrieved and formatted %d secrets.", len(secretsAsKeyValue))
|
||||
|
||||
for key, value := range secret.Data.Data {
|
||||
secretsAsKeyValue = append(secretsAsKeyValue, fmt.Sprintf("%s=%v", key, value))
|
||||
}
|
||||
config.InfoLog("Successfully retrieved and formatted %d secrets.", len(secret.Data.Data))
|
||||
|
||||
config.InfoLog("Successfully retrieved and formatted %d secrets.", len(secretsAsKeyValue))
|
||||
|
||||
return secretsAsKeyValue, nil
|
||||
return secret.Data.Data, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue