mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
Add inline support for middleware/hosts (#1072)
This fix add inline support for middleware/hosts so that
it is possible to specify hosts file insides the Corefile:
```
hosts inline example.org {
10.0.0.1 example.org
fallthrough
}
```
This fix fixes 999.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
@@ -80,6 +81,11 @@ func hostsParse(c *caddy.Controller) (Hosts, error) {
|
||||
}
|
||||
return h, c.ArgErr()
|
||||
default:
|
||||
if !h.Fallthrough {
|
||||
line := strings.Join(append([]string{c.Val()}, c.RemainingArgs()...), " ")
|
||||
h.inline = append(h.inline, line)
|
||||
continue
|
||||
}
|
||||
return h, c.Errf("unknown property '%s'", c.Val())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user