fix(tls_dir): include desired dir
This commit is contained in:
parent
92b4b1010c
commit
bf26fce534
@ -135,12 +135,22 @@ func (ctx *renderContext) templateFuncs(ctxMap map[string]interface{}) map[strin
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
key := name
|
||||||
if req.PerHost {
|
if req.PerHost {
|
||||||
name = name + "/" + ctx.Host.Name
|
key += "/" + ctx.Host.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if funcName == "tls_dir" {
|
||||||
|
// needs the dir name
|
||||||
|
dir := "/etc/tls/" + name
|
||||||
|
|
||||||
|
s = fmt.Sprintf("{{ %s %q %q %q %q %q %q %q }}", funcName,
|
||||||
|
dir, cluster, req.CA, key, req.Profile, req.Label, buf.String())
|
||||||
|
|
||||||
|
} else {
|
||||||
s = fmt.Sprintf("{{ %s %q %q %q %q %q %q }}", funcName,
|
s = fmt.Sprintf("{{ %s %q %q %q %q %q %q }}", funcName,
|
||||||
cluster, req.CA, name, req.Profile, req.Label, buf.String())
|
cluster, req.CA, key, req.Profile, req.Label, buf.String())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ func (ctx *renderContext) templateFuncs() map[string]interface{} {
|
|||||||
return
|
return
|
||||||
},
|
},
|
||||||
|
|
||||||
"tls_dir": func(cluster, caName, name, profile, label, reqJson string) (s string, err error) {
|
"tls_dir": func(dir, cluster, caName, name, profile, label, reqJson string) (s string, err error) {
|
||||||
ca, err := secretData.CA(cluster, caName)
|
ca, err := secretData.CA(cluster, caName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -212,8 +212,6 @@ func (ctx *renderContext) templateFuncs() map[string]interface{} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dir := "/etc/tls/" + name
|
|
||||||
|
|
||||||
return asYaml([]config.FileDef{
|
return asYaml([]config.FileDef{
|
||||||
{
|
{
|
||||||
Path: path.Join(dir, "ca.crt"),
|
Path: path.Join(dir, "ca.crt"),
|
||||||
|
Loading…
Reference in New Issue
Block a user