mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 16:54:15 -04:00
Use Corefile
Fix the code copied from Caddy to refer to Corefile and make 'coredns' with flags pickup a local Corefile. Also remove some references to Caddy in the docs and output of coredns. Fixes #235
This commit is contained in:
@@ -20,9 +20,10 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.TrapSignals()
|
caddy.TrapSignals()
|
||||||
|
caddy.DefaultConfigFile = "Corefile"
|
||||||
setVersion()
|
setVersion()
|
||||||
|
|
||||||
flag.StringVar(&conf, "conf", "", "Caddyfile to load (default \""+caddy.DefaultConfigFile+"\")")
|
flag.StringVar(&conf, "conf", "", "Corefile to load (default \""+caddy.DefaultConfigFile+"\")")
|
||||||
flag.StringVar(&cpu, "cpu", "100%", "CPU cap")
|
flag.StringVar(&cpu, "cpu", "100%", "CPU cap")
|
||||||
flag.BoolVar(&plugins, "plugins", false, "List installed plugins")
|
flag.BoolVar(&plugins, "plugins", false, "List installed plugins")
|
||||||
flag.StringVar(&logfile, "log", "", "Process log file")
|
flag.StringVar(&logfile, "log", "", "Process log file")
|
||||||
@@ -76,14 +77,14 @@ func Run() {
|
|||||||
mustLogFatal(err)
|
mustLogFatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Caddyfile input
|
// Get Corefile input
|
||||||
caddyfile, err := caddy.LoadCaddyfile(serverType)
|
corefile, err := caddy.LoadCaddyfile(serverType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mustLogFatal(err)
|
mustLogFatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start your engines
|
// Start your engines
|
||||||
instance, err := caddy.Start(caddyfile)
|
instance, err := caddy.Start(corefile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mustLogFatal(err)
|
mustLogFatal(err)
|
||||||
}
|
}
|
||||||
@@ -126,7 +127,7 @@ func confLoader(serverType string) (caddy.Input, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaultLoader loads the Caddyfile from the current working directory.
|
// defaultLoader loads the Corefile from the current working directory.
|
||||||
func defaultLoader(serverType string) (caddy.Input, error) {
|
func defaultLoader(serverType string) (caddy.Input, error) {
|
||||||
contents, err := ioutil.ReadFile(caddy.DefaultConfigFile)
|
contents, err := ioutil.ReadFile(caddy.DefaultConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user