plugin/tls: respect the path specified by root plugin (#6138)

* plugin/tls: respect the path specified by root plugin

Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>

* improve readme

Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>

---------

Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>
This commit is contained in:
Marius Kimmina
2023-12-08 16:50:30 +01:00
committed by GitHub
parent f9d5d0cb56
commit 92ec849acb
8 changed files with 86 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package tls
import (
ctls "crypto/tls"
"path/filepath"
"github.com/coredns/caddy"
"github.com/coredns/coredns/core/dnsserver"
@@ -57,6 +58,11 @@ func parseTLS(c *caddy.Controller) error {
return c.Errf("unknown option '%s'", c.Val())
}
}
for i := range args {
if !filepath.IsAbs(args[i]) && config.Root != "" {
args[i] = filepath.Join(config.Root, args[i])
}
}
tls, err := tls.NewTLSConfigFromArgs(args...)
if err != nil {
return err