diff options
author | Matthew Holt <[email protected]> | 2019-12-31 16:56:19 -0700 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-12-31 16:56:19 -0700 |
commit | 5a0603ed72cead424a34b3bc5af3a5b1629ac187 (patch) | |
tree | 03fa4f722d2b5b79986d14cfeeac9294cafc08e7 /admin.go | |
parent | 984d384d148090cdb0f6aa2f234a8b946c3b9ee3 (diff) | |
download | caddy-5a0603ed72cead424a34b3bc5af3a5b1629ac187.tar.gz caddy-5a0603ed72cead424a34b3bc5af3a5b1629ac187.zip |
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 'admin.go')
-rw-r--r-- | admin.go | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -66,6 +66,16 @@ type AdminConfig struct { // will be the default value. If set but empty, no origins will // be allowed. Origins []string `json:"origins,omitempty"` + + // Options related to configuration management. + Config *ConfigSettings `json:"config,omitempty"` +} + +// ConfigSettings configures the, uh, configuration... and +// management thereof. +type ConfigSettings struct { + // Whether to keep a copy of the active config on disk. Default is true. + Persist *bool `json:"persist,omitempty"` } // listenAddr extracts a singular listen address from ac.Listen, @@ -775,7 +785,11 @@ traverseLoop: return nil } -// RemoveMetaFields removes meta fields like "@id" from a JSON message. +// RemoveMetaFields removes meta fields like "@id" from a JSON message +// by using a simple regular expression. (An alternate way to do this +// would be to delete them from the raw, map[string]interface{} +// representation as they are indexed, then iterate the index we made +// and add them back after encoding as JSON, but this is simpler.) func RemoveMetaFields(rawJSON []byte) []byte { return idRegexp.ReplaceAllFunc(rawJSON, func(in []byte) []byte { // matches with a comma on both sides (when "@id" property is |