diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-12-31 16:56:19 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-12-31 16:56:19 -0700 |
commit | 5a0603ed72cead424a34b3bc5af3a5b1629ac187 (patch) | |
tree | 03fa4f722d2b5b79986d14cfeeac9294cafc08e7 /cmd/main.go | |
parent | 984d384d148090cdb0f6aa2f234a8b946c3b9ee3 (diff) |
Config auto-save; run --resume flag; update environ output (close #2903)
Config auto-saving is on by default and can be disabled. The --environ
flag (or environ subcommand) now print more useful information from
Caddy and the runtime, including some nifty paths.
Diffstat (limited to 'cmd/main.go')
-rw-r--r-- | cmd/main.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cmd/main.go b/cmd/main.go index ca9b914..564ef9f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -110,6 +110,9 @@ func loadConfig(configFile, adapterName string) ([]byte, error) { if err != nil { return nil, fmt.Errorf("reading config file: %v", err) } + caddy.Log().Info("using provided configuration", + zap.String("config_file", configFile), + zap.String("config_adapter", adapterName)) } else if adapterName == "" { // as a special case when no config file or adapter // is specified, see if the Caddyfile adapter is @@ -126,6 +129,7 @@ func loadConfig(configFile, adapterName string) ([]byte, error) { } else { // success reading default Caddyfile configFile = "Caddyfile" + caddy.Log().Info("using adjacent Caddyfile") } } } @@ -225,6 +229,21 @@ func flagHelp(fs *flag.FlagSet) string { } func printEnvironment() { + fmt.Printf("caddy.HomeDir=%s\n", caddy.HomeDir()) + fmt.Printf("caddy.AppDataDir=%s\n", caddy.AppDataDir()) + fmt.Printf("caddy.AppConfigDir=%s\n", caddy.AppConfigDir()) + fmt.Printf("caddy.ConfigAutosavePath=%s\n", caddy.ConfigAutosavePath) + fmt.Printf("runtime.GOOS=%s\n", runtime.GOOS) + fmt.Printf("runtime.GOARCH=%s\n", runtime.GOARCH) + fmt.Printf("runtime.Compiler=%s\n", runtime.Compiler) + fmt.Printf("runtime.NumCPU=%d\n", runtime.NumCPU()) + fmt.Printf("runtime.GOMAXPROCS=%d\n", runtime.GOMAXPROCS(0)) + fmt.Printf("runtime.Version=%s\n", runtime.Version()) + cwd, err := os.Getwd() + if err != nil { + cwd = fmt.Sprintf("<error: %v>", err) + } + fmt.Printf("os.Getwd=%s\n\n", cwd) for _, v := range os.Environ() { fmt.Println(v) } |