From ca3d9a00989b0ad8e8375295257854cc21d7a083 Mon Sep 17 00:00:00 2001 From: Riley Lahd Date: Sat, 6 Jan 2018 18:08:51 -0700 Subject: [PATCH] Add support for custom CA cert/path in Goldfish config (#220) --- config/config.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 099e4d3b..155f88a4 100644 --- a/config/config.go +++ b/config/config.go @@ -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) { @@ -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()) @@ -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 -} +} \ No newline at end of file