agent: format all CA config fields
This commit is contained in:
parent
a242e5b130
commit
1ce8361aa2
|
@ -76,14 +76,17 @@ func (s *HTTPServer) ConnectCAConfigurationSet(resp http.ResponseWriter, req *ht
|
||||||
|
|
||||||
// A hack to fix up the config types inside of the map[string]interface{}
|
// A hack to fix up the config types inside of the map[string]interface{}
|
||||||
// so that they get formatted correctly during json.Marshal. Without this,
|
// so that they get formatted correctly during json.Marshal. Without this,
|
||||||
// duration values given as text like "24h" end up getting output back
|
// string values that get converted to []uint8 end up getting output back
|
||||||
// to the user in base64-encoded form.
|
// to the user in base64-encoded form.
|
||||||
func fixupConfig(conf *structs.CAConfiguration) {
|
func fixupConfig(conf *structs.CAConfiguration) {
|
||||||
if conf.Provider == structs.ConsulCAProvider {
|
if conf.Provider == structs.ConsulCAProvider {
|
||||||
if v, ok := conf.Config["RotationPeriod"]; ok {
|
for k, v := range conf.Config {
|
||||||
if raw, ok := v.([]uint8); ok {
|
if raw, ok := v.([]uint8); ok {
|
||||||
conf.Config["RotationPeriod"] = ca.Uint8ToString(raw)
|
conf.Config[k] = ca.Uint8ToString(raw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if conf.Config["PrivateKey"] != "" {
|
||||||
|
conf.Config["PrivateKey"] = "hidden"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue