mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
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.
This commit is contained in:
parent
984d384d14
commit
5a0603ed72
5 changed files with 94 additions and 24 deletions
16
admin.go
16
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue