Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
caddyconfig: Minor internal and godoc tweaks
Matthew Holt committed
May 29, 2020 at 11:49 UTC
6c051cd27d3b0c61b103a58dce9f779481fa993b
4 files changed
+11
-14
caddyconfig/configadapters.go
+7
-8
@@ -51,14 +51,13 @@ func JSON(val interface{}, warnings *[]Warning) json.RawMessage {
51
return b
52
}
53
54
-// JSONModuleObject is like JSON, except it marshals val into a JSON object
55
-// and then adds a key to that object named fieldName with the value fieldVal.
56
-// This is useful for JSON-encoding module values where the module name has to
57
-// be described within the object by a certain key; for example,
58
-// "responder": "file_server" for a file server HTTP responder. The val must
59
-// encode into a map[string]interface{} (i.e. it must be a struct or map),
60
-// and any errors are converted into warnings, so this can be conveniently
61
-// used when filling a struct. For correct code, there should be no errors.
54
+// JSONModuleObject is like JSON(), except it marshals val into a JSON object
55
+// with an added key named fieldName with the value fieldVal. This is useful
56
+// for encoding module values where the module name has to be described within
57
+// the object by a certain key; for example, `"handler": "file_server"` for a
58
+// file server HTTP handler (fieldName="handler" and fieldVal="file_server").
59
+// The val parameter must encode into a map[string]interface{} (i.e. it must be
60
+// a struct or map). Any errors are converted into warnings.
61
func JSONModuleObject(val interface{}, fieldName, fieldVal string, warnings *[]Warning) json.RawMessage {
62
// encode to a JSON object first
63
enc, err := json.Marshal(val)
caddyconfig/httpcaddyfile/builtins.go
+2
-2
@@ -259,13 +259,13 @@ func parseTLS(h Helper) ([]ConfigValue, error) {
259
// certificate loaders
260
if len(fileLoader) > 0 {
261
configVals = append(configVals, ConfigValue{
262
- Class: "tls.certificate_loader",
262
+ Class: "tls.cert_loader",
263
Value: fileLoader,
264
})
265
}
266
if len(folderLoader) > 0 {
267
configVals = append(configVals, ConfigValue{
268
- Class: "tls.certificate_loader",
268
+ Class: "tls.cert_loader",
269
Value: folderLoader,
270
})
271
}
caddyconfig/httpcaddyfile/tlsapp.go
+1
-1
@@ -233,7 +233,7 @@ func (st ServerType) buildTLSApp(
233
}
234
235
// certificate loaders
236
- if clVals, ok := sblock.pile["tls.certificate_loader"]; ok {
236
+ if clVals, ok := sblock.pile["tls.cert_loader"]; ok {
237
for _, clVal := range clVals {
238
certLoaders = append(certLoaders, clVal.Value.(caddytls.CertificateLoader))
239
}
modules/logging/filters.go
+1
-3
@@ -27,9 +27,7 @@ func init() {
27
}
28
29
// LogFieldFilter can filter (or manipulate)
30
-// a field in a log entry. If delete is true,
31
-// out will be ignored and the field will be
32
-// removed from the output.
30
+// a field in a log entry.
31
type LogFieldFilter interface {
32
Filter(zapcore.Field) zapcore.Field
33
}