Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
Add support for custom CA cert/path in Goldfish config (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
sircinnamon authored and Caiyeon committed Jan 7, 2018
1 parent 9c75ad5 commit ca3d9a0
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type VaultConfig struct {
Runtime_config string
Approle_login string
Approle_id string
CA_cert string
CA_path string
}

func LoadConfigFile(path string) (*Config, error) {
Expand Down Expand Up @@ -266,6 +268,8 @@ func parseVault(result *Config, vault *ast.ObjectItem) error {
"runtime_config",
"approle_login",
"approle_id",
"ca_cert",
"ca_path",
}
if err := checkHCLKeys(vault.Val, valid); err != nil {
return fmt.Errorf("vault.%s: %s", key, err.Error())
Expand Down Expand Up @@ -318,5 +322,17 @@ func parseVault(result *Config, vault *ast.ObjectItem) error {
result.Vault.Approle_id = "goldfish"
}

if cacert, ok := m["ca_cert"]; ok && cacert != "" {
result.Vault.CA_cert = cacert
} else {
result.Vault.CA_cert = ""
}

if capath, ok := m["ca_path"]; ok && capath != "" {
result.Vault.CA_path = capath
} else {
result.Vault.CA_path = ""
}

return nil
}
}

0 comments on commit ca3d9a0

Please sign in to comment.