From 5a0603ed72cead424a34b3bc5af3a5b1629ac187 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 31 Dec 2019 16:56:19 -0700 Subject: 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. --- admin.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'admin.go') diff --git a/admin.go b/admin.go index bf11985..7a5d0b6 100644 --- a/admin.go +++ b/admin.go @@ -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 -- cgit v1.2.3