MCPcopy
hub / github.com/caddyserver/caddy / Provision

Method Provision

modules/caddyhttp/fileserver/matcher.go:274–293  ·  view source on GitHub ↗

Provision sets up m's defaults.

(ctx caddy.Context)

Source from the content-addressed store, hash-verified

272
273// Provision sets up m's defaults.
274func (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.
296func (m MatchFile) Validate() error {

Callers 1

CELLibraryMethod · 0.95

Calls 2

FileSystemsMethod · 0.80
LoggerMethod · 0.45

Tested by

no test coverage detected