diff options
author | Matthew Holt <[email protected]> | 2020-05-29 11:49:21 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-05-29 11:49:25 -0600 |
commit | 6c051cd27d3b0c61b103a58dce9f779481fa993b (patch) | |
tree | 3095001af8ae6c4dce13570a2959f1968cca0563 | |
parent | 9415feca7cf0fe14b9d881c7318be2da20b2985f (diff) | |
download | caddy-6c051cd27d3b0c61b103a58dce9f779481fa993b.tar.gz caddy-6c051cd27d3b0c61b103a58dce9f779481fa993b.zip |
caddyconfig: Minor internal and godoc tweaks
-rw-r--r-- | caddyconfig/configadapters.go | 15 | ||||
-rw-r--r-- | caddyconfig/httpcaddyfile/builtins.go | 4 | ||||
-rw-r--r-- | caddyconfig/httpcaddyfile/tlsapp.go | 2 | ||||
-rw-r--r-- | modules/logging/filters.go | 4 |
4 files changed, 11 insertions, 14 deletions
diff --git a/caddyconfig/configadapters.go b/caddyconfig/configadapters.go index 2c466c425..1918fa757 100644 --- a/caddyconfig/configadapters.go +++ b/caddyconfig/configadapters.go @@ -51,14 +51,13 @@ func JSON(val interface{}, warnings *[]Warning) json.RawMessage { return b } -// JSONModuleObject is like JSON, except it marshals val into a JSON object -// and then adds a key to that object named fieldName with the value fieldVal. -// This is useful for JSON-encoding module values where the module name has to -// be described within the object by a certain key; for example, -// "responder": "file_server" for a file server HTTP responder. The val must -// encode into a map[string]interface{} (i.e. it must be a struct or map), -// and any errors are converted into warnings, so this can be conveniently -// used when filling a struct. For correct code, there should be no errors. +// JSONModuleObject is like JSON(), except it marshals val into a JSON object +// with an added key named fieldName with the value fieldVal. This is useful +// for encoding module values where the module name has to be described within +// the object by a certain key; for example, `"handler": "file_server"` for a +// file server HTTP handler (fieldName="handler" and fieldVal="file_server"). +// The val parameter must encode into a map[string]interface{} (i.e. it must be +// a struct or map). Any errors are converted into warnings. func JSONModuleObject(val interface{}, fieldName, fieldVal string, warnings *[]Warning) json.RawMessage { // encode to a JSON object first enc, err := json.Marshal(val) diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go index 7026dfe90..90ce3a461 100644 --- a/caddyconfig/httpcaddyfile/builtins.go +++ b/caddyconfig/httpcaddyfile/builtins.go @@ -259,13 +259,13 @@ func parseTLS(h Helper) ([]ConfigValue, error) { // certificate loaders if len(fileLoader) > 0 { configVals = append(configVals, ConfigValue{ - Class: "tls.certificate_loader", + Class: "tls.cert_loader", Value: fileLoader, }) } if len(folderLoader) > 0 { configVals = append(configVals, ConfigValue{ - Class: "tls.certificate_loader", + Class: "tls.cert_loader", Value: folderLoader, }) } diff --git a/caddyconfig/httpcaddyfile/tlsapp.go b/caddyconfig/httpcaddyfile/tlsapp.go index 80f39af38..90b4e71c8 100644 --- a/caddyconfig/httpcaddyfile/tlsapp.go +++ b/caddyconfig/httpcaddyfile/tlsapp.go @@ -233,7 +233,7 @@ func (st ServerType) buildTLSApp( } // certificate loaders - if clVals, ok := sblock.pile["tls.certificate_loader"]; ok { + if clVals, ok := sblock.pile["tls.cert_loader"]; ok { for _, clVal := range clVals { certLoaders = append(certLoaders, clVal.Value.(caddytls.CertificateLoader)) } diff --git a/modules/logging/filters.go b/modules/logging/filters.go index 52db2fec6..cd3bbb138 100644 --- a/modules/logging/filters.go +++ b/modules/logging/filters.go @@ -27,9 +27,7 @@ func init() { } // LogFieldFilter can filter (or manipulate) -// a field in a log entry. If delete is true, -// out will be ignored and the field will be -// removed from the output. +// a field in a log entry. type LogFieldFilter interface { Filter(zapcore.Field) zapcore.Field } |