aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/assets/path_test.go2
-rw-r--r--core/caddy.go86
-rw-r--r--core/caddy_test.go4
-rw-r--r--core/config.go8
-rw-r--r--core/directives.go2
-rw-r--r--core/helpers.go22
-rw-r--r--core/https/certificates.go2
-rw-r--r--core/https/handshake.go2
-rw-r--r--core/https/https.go2
-rw-r--r--core/https/user.go4
-rw-r--r--core/parse/parsing.go4
-rw-r--r--core/restart.go44
-rw-r--r--core/restart_windows.go16
-rw-r--r--core/setup/log.go28
-rw-r--r--core/sigtrap_posix.go20
15 files changed, 123 insertions, 123 deletions
diff --git a/core/assets/path_test.go b/core/assets/path_test.go
index 50e8841d9..6f2c0bfb7 100644
--- a/core/assets/path_test.go
+++ b/core/assets/path_test.go
@@ -7,6 +7,6 @@ import (
func TestPath(t *testing.T) {
if actual := Path(); !strings.HasSuffix(actual, ".coredns") {
- t.Errorf("Expected path to be a .caddy folder, got: %v", actual)
+ t.Errorf("Expected path to be a .coredns folder, got: %v", actual)
}
}
diff --git a/core/caddy.go b/core/caddy.go
index 5b336a77e..30038d28f 100644
--- a/core/caddy.go
+++ b/core/caddy.go
@@ -1,16 +1,16 @@
-// Package caddy implements the Caddy web server as a service
+// Package caddy implements the CoreDNS web server as a service
// in your own Go programs.
//
// To use this package, follow a few simple steps:
//
// 1. Set the AppName and AppVersion variables.
-// 2. Call LoadCaddyfile() to get the Caddyfile (it
+// 2. Call LoadCorefile() to get the Corefile (it
// might have been piped in as part of a restart).
-// You should pass in your own Caddyfile loader.
-// 3. Call caddy.Start() to start Caddy, caddy.Stop()
+// You should pass in your own Corefile loader.
+// 3. Call caddy.Start() to start CoreDNS, caddy.Stop()
// to stop it, or caddy.Restart() to restart it.
//
-// You should use caddy.Wait() to wait for all Caddy servers
+// You should use caddy.Wait() to wait for all CoreDNS servers
// to quit before your process exits.
package core
@@ -52,14 +52,14 @@ var (
)
var (
- // caddyfile is the input configuration text used for this process
- caddyfile Input
+ // corefile is the input configuration text used for this process
+ corefile Input
- // caddyfileMu protects caddyfile during changes
- caddyfileMu sync.Mutex
+ // corefileMu protects corefile during changes
+ corefileMu sync.Mutex
// errIncompleteRestart occurs if this process is a fork
- // of the parent but no Caddyfile was piped in
+ // of the parent but no Corefile was piped in
errIncompleteRestart = errors.New("incomplete restart")
// servers is a list of all the currently-listening servers
@@ -75,9 +75,9 @@ var (
// a graceful restart; it is used to map listeners to their
// index in the list of inherited file descriptors. This
// variable is not safe for concurrent access.
- loadedGob caddyfileGob
+ loadedGob corefileGob
- // startedBefore should be set to true if caddy has been started
+ // startedBefore should be set to true if CoreDNS has been started
// at least once (does not indicate whether currently running).
startedBefore bool
)
@@ -91,8 +91,8 @@ const (
DefaultRoot = "."
)
-// Start starts Caddy with the given Caddyfile. If cdyfile
-// is nil, the LoadCaddyfile function will be called to get
+// Start starts CoreDNS with the given Corefile. If crfile
+// is nil, the LoadCorefile function will be called to get
// one.
//
// This function blocks until all the servers are listening.
@@ -101,12 +101,12 @@ const (
// restart more than once within the duration of the graceful
// cutoff (i.e. the child process called Start a first time,
// then called Stop, then Start again within the first 5 seconds
-// or however long GracefulTimeout is) and the Caddyfiles have
+// or however long GracefulTimeout is) and the Corefiles have
// at least one listener address in common, the second Start
// may fail with "address already in use" as there's no
// guarantee that the parent process has relinquished the
// address before the grace period ends.
-func Start(cdyfile Input) (err error) {
+func Start(crfile Input) (err error) {
// If we return with no errors, we must do two things: tell the
// parent that we succeeded and write to the pidfile.
defer func() {
@@ -122,19 +122,19 @@ func Start(cdyfile Input) (err error) {
}()
// Input must never be nil; try to load something
- if cdyfile == nil {
- cdyfile, err = LoadCaddyfile(nil)
+ if crfile == nil {
+ crfile, err = LoadCorefile(nil)
if err != nil {
return err
}
}
- caddyfileMu.Lock()
- caddyfile = cdyfile
- caddyfileMu.Unlock()
+ corefileMu.Lock()
+ corefile = crfile
+ corefileMu.Unlock()
// load the server configs (activates Let's Encrypt)
- configs, err := loadConfigs(path.Base(cdyfile.Path()), bytes.NewReader(cdyfile.Body()))
+ configs, err := loadConfigs(path.Base(crfile.Path()), bytes.NewReader(crfile.Body()))
if err != nil {
return err
}
@@ -303,14 +303,14 @@ func Wait() {
wg.Wait()
}
-// LoadCaddyfile loads a Caddyfile, prioritizing a Caddyfile
+// LoadCorefile loads a Corefile, prioritizing a Corefile
// piped from stdin as part of a restart (only happens on first call
-// to LoadCaddyfile). If it is not a restart, this function tries
+// to LoadCorefile). If it is not a restart, this function tries
// calling the user's loader function, and if that returns nil, then
// this function resorts to the default configuration. Thus, if there
// are no other errors, this function always returns at least the
-// default Caddyfile.
-func LoadCaddyfile(loader func() (Input, error)) (cdyfile Input, err error) {
+// default Corefile.
+func LoadCorefile(loader func() (Input, error)) (crfile Input, err error) {
// If we are a fork, finishing the restart is highest priority;
// piped input is required in this case.
if IsRestart() {
@@ -318,30 +318,30 @@ func LoadCaddyfile(loader func() (Input, error)) (cdyfile Input, err error) {
if err != nil {
return nil, err
}
- cdyfile = loadedGob.Caddyfile
+ crfile = loadedGob.Corefile
atomic.StoreInt32(https.OnDemandIssuedCount, loadedGob.OnDemandTLSCertsIssued)
}
// Try user's loader
- if cdyfile == nil && loader != nil {
- cdyfile, err = loader()
+ if crfile == nil && loader != nil {
+ crfile, err = loader()
}
// Otherwise revert to default
- if cdyfile == nil {
- cdyfile = DefaultInput()
+ if crfile == nil {
+ crfile = DefaultInput()
}
return
}
-// CaddyfileFromPipe loads the Caddyfile input from f if f is
+// CorefileFromPipe loads the Corefile input from f if f is
// not interactive input. f is assumed to be a pipe or stream,
// such as os.Stdin. If f is not a pipe, no error is returned
// but the Input value will be nil. An error is only returned
// if there was an error reading the pipe, even if the length
// of what was read is 0.
-func CaddyfileFromPipe(f *os.File) (Input, error) {
+func CorefileFromPipe(f *os.File) (Input, error) {
fi, err := f.Stat()
if err == nil && fi.Mode()&os.ModeCharDevice == 0 {
// Note that a non-nil error is not a problem. Windows
@@ -354,7 +354,7 @@ func CaddyfileFromPipe(f *os.File) (Input, error) {
if err != nil {
return nil, err
}
- return CaddyfileInput{
+ return CorefileInput{
Contents: confBody,
Filepath: f.Name(),
}, nil
@@ -365,20 +365,20 @@ func CaddyfileFromPipe(f *os.File) (Input, error) {
return nil, nil
}
-// Caddyfile returns the current Caddyfile
-func Caddyfile() Input {
- caddyfileMu.Lock()
- defer caddyfileMu.Unlock()
- return caddyfile
+// Corefile returns the current Corefile
+func Corefile() Input {
+ corefileMu.Lock()
+ defer corefileMu.Unlock()
+ return corefile
}
-// Input represents a Caddyfile; its contents and file path
+// Input represents a Corefile; its contents and file path
// (which should include the file name at the end of the path).
// If path does not apply (e.g. piped input) you may use
// any understandable value. The path is mainly used for logging,
// error messages, and debugging.
type Input interface {
- // Gets the Caddyfile contents
+ // Gets the Corefile contents
Body() []byte
// Gets the path to the origin file
@@ -394,8 +394,8 @@ type Input interface {
// with Stop(). It just takes a normal Corefile as input.
func TestServer(t *testing.T, corefile string) (*server.Server, error) {
- cdyfile := CaddyfileInput{Contents: []byte(corefile)}
- configs, err := loadConfigs(path.Base(cdyfile.Path()), bytes.NewReader(cdyfile.Body()))
+ crfile := CorefileInput{Contents: []byte(corefile)}
+ configs, err := loadConfigs(path.Base(crfile.Path()), bytes.NewReader(crfile.Body()))
if err != nil {
return nil, err
}
diff --git a/core/caddy_test.go b/core/caddy_test.go
index 539c88a43..89ec3d045 100644
--- a/core/caddy_test.go
+++ b/core/caddy_test.go
@@ -2,10 +2,10 @@ package core
/*
func TestCaddyStartStop(t *testing.T) {
- caddyfile := "localhost:1984"
+ corefile := "localhost:1984"
for i := 0; i < 2; i++ {
- err := Start(CaddyfileInput{Contents: []byte(caddyfile)})
+ err := Start(CorefileInput{Contents: []byte(corefile)})
if err != nil {
t.Fatalf("Error starting, iteration %d: %v", i, err)
}
diff --git a/core/config.go b/core/config.go
index 5cdaacee6..eea099a70 100644
--- a/core/config.go
+++ b/core/config.go
@@ -23,7 +23,7 @@ func loadConfigsUpToIncludingTLS(filename string, input io.Reader) ([]server.Con
var configs []server.Config
// Each server block represents similar hosts/addresses, since they
- // were grouped together in the Caddyfile.
+ // were grouped together in the Corefile.
serverBlocks, err := parse.ServerBlocks(filename, input, true)
if err != nil {
return nil, nil, 0, err
@@ -304,12 +304,12 @@ func validDirective(d string) bool {
return false
}
-// DefaultInput returns the default Caddyfile input
+// DefaultInput returns the default Corefile input
// to use when it is otherwise empty or missing.
// It uses the default host and port and root.
-func DefaultInput() CaddyfileInput {
+func DefaultInput() CorefileInput {
port := Port
- return CaddyfileInput{
+ return CorefileInput{
Contents: []byte(fmt.Sprintf("%s:%s\nroot %s", Host, port, Root)),
}
}
diff --git a/core/directives.go b/core/directives.go
index 3a56783ff..3de69f8fb 100644
--- a/core/directives.go
+++ b/core/directives.go
@@ -68,7 +68,7 @@ var directiveOrder = []directive{
{"proxy", setup.Proxy},
}
-// RegisterDirective adds the given directive to caddy's list of directives.
+// RegisterDirective adds the given directive to CoreDNS's list of directives.
// Pass the name of a directive you want it to be placed after,
// otherwise it will be placed at the bottom of the stack.
func RegisterDirective(name string, setup SetupFunc, after string) {
diff --git a/core/helpers.go b/core/helpers.go
index 8ef6a54cd..82a0150af 100644
--- a/core/helpers.go
+++ b/core/helpers.go
@@ -57,24 +57,24 @@ func signalSuccessToParent() {
// signaled once; doing so more than once breaks whatever socket is
// at fd 4 (the reason for this is still unclear - to reproduce,
// call Stop() and Start() in succession at least once after a
-// restart, then try loading first host of Caddyfile in the browser).
+// restart, then try loading first host of Corefile in the browser).
// Do not use this directly - call signalSuccessToParent instead.
var signalParentOnce sync.Once
-// caddyfileGob maps bind address to index of the file descriptor
+// corefileGob maps bind address to index of the file descriptor
// in the Files array passed to the child process. It also contains
-// the caddyfile contents and other state needed by the new process.
+// the corefile contents and other state needed by the new process.
// Used only during graceful restarts where a new process is spawned.
-type caddyfileGob struct {
+type corefileGob struct {
ListenerFds map[string]uintptr
- Caddyfile Input
+ Corefile Input
OnDemandTLSCertsIssued int32
}
// IsRestart returns whether this process is, according
// to env variables, a fork as part of a graceful restart.
func IsRestart() bool {
- return os.Getenv("CADDY_RESTART") == "true"
+ return os.Getenv("COREDNS_RESTART") == "true"
}
// writePidFile writes the process ID to the file at PidFile, if specified.
@@ -83,20 +83,20 @@ func writePidFile() error {
return ioutil.WriteFile(PidFile, pid, 0644)
}
-// CaddyfileInput represents a Caddyfile as input
+// CorefileInput represents a Corefile as input
// and is simply a convenient way to implement
// the Input interface.
-type CaddyfileInput struct {
+type CorefileInput struct {
Filepath string
Contents []byte
RealFile bool
}
// Body returns c.Contents.
-func (c CaddyfileInput) Body() []byte { return c.Contents }
+func (c CorefileInput) Body() []byte { return c.Contents }
// Path returns c.Filepath.
-func (c CaddyfileInput) Path() string { return c.Filepath }
+func (c CorefileInput) Path() string { return c.Filepath }
// IsFile returns true if the original input was a real file on the file system.
-func (c CaddyfileInput) IsFile() bool { return c.RealFile }
+func (c CorefileInput) IsFile() bool { return c.RealFile }
diff --git a/core/https/certificates.go b/core/https/certificates.go
index 0dc3db523..6a8f3adc6 100644
--- a/core/https/certificates.go
+++ b/core/https/certificates.go
@@ -33,7 +33,7 @@ type Certificate struct {
// NotAfter is when the certificate expires.
NotAfter time.Time
- // Managed certificates are certificates that Caddy is managing,
+ // Managed certificates are certificates that CoreDNS is managing,
// as opposed to the user specifying a certificate and key file
// or directory and managing the certificate resources themselves.
Managed bool
diff --git a/core/https/handshake.go b/core/https/handshake.go
index 1334b9ff4..a05231c49 100644
--- a/core/https/handshake.go
+++ b/core/https/handshake.go
@@ -301,7 +301,7 @@ var OnDemandIssuedCount = new(int32)
// maximum number of certificates that can be issued.
// TODO: This applies globally, but we should probably make a server-specific
// way to keep track of these limits and counts, since it's specified in the
-// Caddyfile...
+// Corefile...
var onDemandMaxIssue int32
// failedIssuance is a set of names that we recently failed to get a
diff --git a/core/https/https.go b/core/https/https.go
index 7763c0a16..99ef2fef6 100644
--- a/core/https/https.go
+++ b/core/https/https.go
@@ -1,5 +1,5 @@
// Package https facilitates the management of TLS assets and integrates
-// Let's Encrypt functionality into Caddy with first-class support for
+// Let's Encrypt functionality into CoreDNS with first-class support for
// creating and renewing certificates automatically. It is designed to
// configure sites for HTTPS by default.
package https
diff --git a/core/https/user.go b/core/https/user.go
index 13d93b1da..9c30c656c 100644
--- a/core/https/user.go
+++ b/core/https/user.go
@@ -121,14 +121,14 @@ func newUser(email string) (User, error) {
// input. If userPresent is false, the operator will
// NOT be prompted and an empty email may be returned.
func getEmail(cfg server.Config, userPresent bool) string {
- // First try the tls directive from the Caddyfile
+ // First try the tls directive from the Corefile
leEmail := cfg.TLS.LetsEncryptEmail
if leEmail == "" {
// Then try memory (command line flag or typed by user previously)
leEmail = DefaultEmail
}
if leEmail == "" {
- // Then try to get most recent user email ~/.caddy/users file
+ // Then try to get most recent user email ~/.coredns/users file
userDirs, err := ioutil.ReadDir(storage.Users())
if err == nil {
var mostRecent os.FileInfo
diff --git a/core/parse/parsing.go b/core/parse/parsing.go
index 712695b22..7be7d6714 100644
--- a/core/parse/parsing.go
+++ b/core/parse/parsing.go
@@ -55,7 +55,7 @@ func (p *parser) begin() error {
}
if p.eof {
- // this happens if the Caddyfile consists of only
+ // this happens if the Corefile consists of only
// a line of addresses and nothing else
return nil
}
@@ -91,7 +91,7 @@ func (p *parser) addresses() error {
break
}
- if tkn != "" { // empty token possible if user typed "" in Caddyfile
+ if tkn != "" { // empty token possible if user typed "" in Corefile
// Trailing comma indicates another address will follow, which
// may possibly be on the next line
if tkn[len(tkn)-1] == ',' {
diff --git a/core/restart.go b/core/restart.go
index 82567d35c..c13a8fe7c 100644
--- a/core/restart.go
+++ b/core/restart.go
@@ -18,32 +18,32 @@ import (
)
func init() {
- gob.Register(CaddyfileInput{})
+ gob.Register(CorefileInput{})
}
// Restart restarts the entire application; gracefully with zero
// downtime if on a POSIX-compatible system, or forcefully if on
// Windows but with imperceptibly-short downtime.
//
-// The restarted application will use newCaddyfile as its input
-// configuration. If newCaddyfile is nil, the current (existing)
-// Caddyfile configuration will be used.
+// The restarted application will use newCorefile as its input
+// configuration. If newCorefile is nil, the current (existing)
+// Corefile configuration will be used.
//
// Note: The process must exist in the same place on the disk in
// order for this to work. Thus, multiple graceful restarts don't
// work if executing with `go run`, since the binary is cleaned up
// when `go run` sees the initial parent process exit.
-func Restart(newCaddyfile Input) error {
+func Restart(newCorefile Input) error {
log.Println("[INFO] Restarting")
- if newCaddyfile == nil {
- caddyfileMu.Lock()
- newCaddyfile = caddyfile
- caddyfileMu.Unlock()
+ if newCorefile == nil {
+ corefileMu.Lock()
+ newCorefile = corefile
+ corefileMu.Unlock()
}
- // Get certificates for any new hosts in the new Caddyfile without causing downtime
- err := getCertsForNewCaddyfile(newCaddyfile)
+ // Get certificates for any new hosts in the new Corefile without causing downtime
+ err := getCertsForNewCorefile(newCorefile)
if err != nil {
return errors.New("TLS preload: " + err.Error())
}
@@ -53,16 +53,16 @@ func Restart(newCaddyfile Input) error {
}
// Tell the child that it's a restart
- os.Setenv("CADDY_RESTART", "true")
+ os.Setenv("COREDNS_RESTART", "true")
// Prepare our payload to the child process
- cdyfileGob := caddyfileGob{
+ crfileGob := corefileGob{
ListenerFds: make(map[string]uintptr),
- Caddyfile: newCaddyfile,
+ Corefile: newCorefile,
OnDemandTLSCertsIssued: atomic.LoadInt32(https.OnDemandIssuedCount),
}
- // Prepare a pipe to the fork's stdin so it can get the Caddyfile
+ // Prepare a pipe to the fork's stdin so it can get the Corefile
rpipe, wpipe, err := os.Pipe()
if err != nil {
return err
@@ -83,7 +83,7 @@ func Restart(newCaddyfile Input) error {
serversMu.Lock()
for i, s := range servers {
extraFiles = append(extraFiles, s.ListenerFd())
- cdyfileGob.ListenerFds[s.Addr] = uintptr(4 + i) // 4 fds come before any of the listeners
+ crfileGob.ListenerFds[s.Addr] = uintptr(4 + i) // 4 fds come before any of the listeners
}
serversMu.Unlock()
@@ -105,8 +105,8 @@ func Restart(newCaddyfile Input) error {
f.Close()
}
- // Feed Caddyfile to the child
- err = gob.NewEncoder(wpipe).Encode(cdyfileGob)
+ // Feed Corefile to the child
+ err = gob.NewEncoder(wpipe).Encode(crfileGob)
if err != nil {
return err
}
@@ -127,12 +127,12 @@ func Restart(newCaddyfile Input) error {
return Stop()
}
-func getCertsForNewCaddyfile(newCaddyfile Input) error {
- // parse the new caddyfile only up to (and including) TLS
+func getCertsForNewCorefile(newCorefile Input) error {
+ // parse the new corefile only up to (and including) TLS
// so we can know what we need to get certs for.
- configs, _, _, err := loadConfigsUpToIncludingTLS(path.Base(newCaddyfile.Path()), bytes.NewReader(newCaddyfile.Body()))
+ configs, _, _, err := loadConfigsUpToIncludingTLS(path.Base(newCorefile.Path()), bytes.NewReader(newCorefile.Body()))
if err != nil {
- return errors.New("loading Caddyfile: " + err.Error())
+ return errors.New("loading Corefile: " + err.Error())
}
// first mark the configs that are qualified for managed TLS
diff --git a/core/restart_windows.go b/core/restart_windows.go
index c2a4f557a..8a0805a19 100644
--- a/core/restart_windows.go
+++ b/core/restart_windows.go
@@ -2,15 +2,15 @@ package core
import "log"
-// Restart restarts Caddy forcefully using newCaddyfile,
-// or, if nil, the current/existing Caddyfile is reused.
-func Restart(newCaddyfile Input) error {
+// Restart restarts CoreDNS forcefully using newCorefile,
+// or, if nil, the current/existing Corefile is reused.
+func Restart(newCorefile Input) error {
log.Println("[INFO] Restarting")
- if newCaddyfile == nil {
- caddyfileMu.Lock()
- newCaddyfile = caddyfile
- caddyfileMu.Unlock()
+ if newCorefile == nil {
+ corefileMu.Lock()
+ newCorefile = corefile
+ corefileMu.Unlock()
}
wg.Add(1) // barrier so Wait() doesn't unblock
@@ -20,7 +20,7 @@ func Restart(newCaddyfile Input) error {
return err
}
- err = Start(newCaddyfile)
+ err = Start(newCorefile)
if err != nil {
return err
}
diff --git a/core/setup/log.go b/core/setup/log.go
index 29c3b8746..1deca2565 100644
--- a/core/setup/log.go
+++ b/core/setup/log.go
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/go-syslog"
"github.com/miekg/coredns/middleware"
- caddylog "github.com/miekg/coredns/middleware/log"
+ corednslog "github.com/miekg/coredns/middleware/log"
"github.com/miekg/coredns/server"
"github.com/miekg/dns"
)
@@ -30,7 +30,7 @@ func Log(c *Controller) (middleware.Middleware, error) {
} else if rules[i].OutputFile == "stderr" {
writer = os.Stderr
} else if rules[i].OutputFile == "syslog" {
- writer, err = gsyslog.NewLogger(gsyslog.LOG_INFO, "LOCAL0", "caddy")
+ writer, err = gsyslog.NewLogger(gsyslog.LOG_INFO, "LOCAL0", "coredns")
if err != nil {
return err
}
@@ -56,12 +56,12 @@ func Log(c *Controller) (middleware.Middleware, error) {
})
return func(next middleware.Handler) middleware.Handler {
- return caddylog.Logger{Next: next, Rules: rules, ErrorFunc: server.DefaultErrorFunc}
+ return corednslog.Logger{Next: next, Rules: rules, ErrorFunc: server.DefaultErrorFunc}
}, nil
}
-func logParse(c *Controller) ([]caddylog.Rule, error) {
- var rules []caddylog.Rule
+func logParse(c *Controller) ([]corednslog.Rule, error) {
+ var rules []corednslog.Rule
for c.Next() {
args := c.RemainingArgs()
@@ -88,37 +88,37 @@ func logParse(c *Controller) ([]caddylog.Rule, error) {
}
if len(args) == 0 {
// Nothing specified; use defaults
- rules = append(rules, caddylog.Rule{
+ rules = append(rules, corednslog.Rule{
NameScope: ".",
- OutputFile: caddylog.DefaultLogFilename,
- Format: caddylog.DefaultLogFormat,
+ OutputFile: corednslog.DefaultLogFilename,
+ Format: corednslog.DefaultLogFormat,
Roller: logRoller,
})
} else if len(args) == 1 {
// Only an output file specified
- rules = append(rules, caddylog.Rule{
+ rules = append(rules, corednslog.Rule{
NameScope: ".",
OutputFile: args[0],
- Format: caddylog.DefaultLogFormat,
+ Format: corednslog.DefaultLogFormat,
Roller: logRoller,
})
} else {
// Name scope, output file, and maybe a format specified
- format := caddylog.DefaultLogFormat
+ format := corednslog.DefaultLogFormat
if len(args) > 2 {
switch args[2] {
case "{common}":
- format = caddylog.CommonLogFormat
+ format = corednslog.CommonLogFormat
case "{combined}":
- format = caddylog.CombinedLogFormat
+ format = corednslog.CombinedLogFormat
default:
format = args[2]
}
}
- rules = append(rules, caddylog.Rule{
+ rules = append(rules, corednslog.Rule{
NameScope: dns.Fqdn(args[0]),
OutputFile: args[1],
Format: format,
diff --git a/core/sigtrap_posix.go b/core/sigtrap_posix.go
index 5ba5fcd1b..d120dd52b 100644
--- a/core/sigtrap_posix.go
+++ b/core/sigtrap_posix.go
@@ -48,28 +48,28 @@ func trapSignalsPosix() {
case syscall.SIGUSR1:
log.Println("[INFO] SIGUSR1: Reloading")
- var updatedCaddyfile Input
+ var updatedCorefile Input
- caddyfileMu.Lock()
- if caddyfile == nil {
+ corefileMu.Lock()
+ if corefile == nil {
// Hmm, did spawing process forget to close stdin? Anyhow, this is unusual.
log.Println("[ERROR] SIGUSR1: no Corefile to reload (was stdin left open?)")
- caddyfileMu.Unlock()
+ corefileMu.Unlock()
continue
}
- if caddyfile.IsFile() {
- body, err := ioutil.ReadFile(caddyfile.Path())
+ if corefile.IsFile() {
+ body, err := ioutil.ReadFile(corefile.Path())
if err == nil {
- updatedCaddyfile = CaddyfileInput{
- Filepath: caddyfile.Path(),
+ updatedCorefile = CorefileInput{
+ Filepath: corefile.Path(),
Contents: body,
RealFile: true,
}
}
}
- caddyfileMu.Unlock()
+ corefileMu.Unlock()
- err := Restart(updatedCaddyfile)
+ err := Restart(updatedCorefile)
if err != nil {
log.Printf("[ERROR] SIGUSR1: %v", err)
}