Provision sets up m's defaults.
(ctx caddy.Context)
| 272 | |
| 273 | // Provision sets up m's defaults. |
| 274 | func (m *MatchFile) Provision(ctx caddy.Context) error { |
| 275 | m.logger = ctx.Logger() |
| 276 | |
| 277 | m.fsmap = ctx.FileSystems() |
| 278 | |
| 279 | if m.Root == "" { |
| 280 | m.Root = "{http.vars.root}" |
| 281 | } |
| 282 | |
| 283 | if m.FileSystem == "" { |
| 284 | m.FileSystem = "{http.vars.fs}" |
| 285 | } |
| 286 | |
| 287 | // if list of files to try was omitted entirely, assume URL path |
| 288 | // (use placeholder instead of r.URL.Path; see issue #4146) |
| 289 | if m.TryFiles == nil { |
| 290 | m.TryFiles = []string{"{http.request.uri.path}"} |
| 291 | } |
| 292 | return nil |
| 293 | } |
| 294 | |
| 295 | // Validate ensures m has a valid configuration. |
| 296 | func (m MatchFile) Validate() error { |
no test coverage detected