Handler implements a middleware that maps inputs to outputs. Specifically, it compares a source value against the map inputs, and for one that matches, it applies the output values to each destination. Destinations become placeholder names. Mapped placeholders are not evaluated until they are used,
| 37 | // Mapped placeholders are not evaluated until they are used, so even for very |
| 38 | // large mappings, this handler is quite efficient. |
| 39 | type Handler struct { |
| 40 | // Source is the placeholder from which to get the input value. |
| 41 | Source string `json:"source,omitempty"` |
| 42 | |
| 43 | // Destinations are the names of placeholders in which to store the outputs. |
| 44 | // Destination values should be wrapped in braces, for example, {my_placeholder}. |
| 45 | Destinations []string `json:"destinations,omitempty"` |
| 46 | |
| 47 | // Mappings from source values (inputs) to destination values (outputs). |
| 48 | // The first matching, non-nil mapping will be applied. |
| 49 | Mappings []Mapping `json:"mappings,omitempty"` |
| 50 | |
| 51 | // If no mappings match or if the mapped output is null/nil, the associated |
| 52 | // default output will be applied (optional). |
| 53 | Defaults []string `json:"defaults,omitempty"` |
| 54 | } |
| 55 | |
| 56 | // CaddyModule returns the Caddy module information. |
| 57 | func (Handler) CaddyModule() caddy.ModuleInfo { |
nothing calls this directly
no outgoing calls
no test coverage detected