mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
fileserver: good default for precompressed (#6736)
This commit is contained in:
parent
57ae9c3107
commit
5c2617ebf9
1 changed files with 8 additions and 6 deletions
|
@ -146,9 +146,13 @@ func (fsrv *FileServer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "precompressed":
|
case "precompressed":
|
||||||
var order []string
|
fsrv.PrecompressedOrder = d.RemainingArgs()
|
||||||
for d.NextArg() {
|
if len(fsrv.PrecompressedOrder) == 0 {
|
||||||
modID := "http.precompressed." + d.Val()
|
fsrv.PrecompressedOrder = []string{"br", "zstd", "gzip"}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, format := range fsrv.PrecompressedOrder {
|
||||||
|
modID := "http.precompressed." + format
|
||||||
mod, err := caddy.GetModule(modID)
|
mod, err := caddy.GetModule(modID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Errf("getting module named '%s': %v", modID, err)
|
return d.Errf("getting module named '%s': %v", modID, err)
|
||||||
|
@ -161,10 +165,8 @@ func (fsrv *FileServer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||||
if fsrv.PrecompressedRaw == nil {
|
if fsrv.PrecompressedRaw == nil {
|
||||||
fsrv.PrecompressedRaw = make(caddy.ModuleMap)
|
fsrv.PrecompressedRaw = make(caddy.ModuleMap)
|
||||||
}
|
}
|
||||||
fsrv.PrecompressedRaw[d.Val()] = caddyconfig.JSON(precompress, nil)
|
fsrv.PrecompressedRaw[format] = caddyconfig.JSON(precompress, nil)
|
||||||
order = append(order, d.Val())
|
|
||||||
}
|
}
|
||||||
fsrv.PrecompressedOrder = order
|
|
||||||
|
|
||||||
case "status":
|
case "status":
|
||||||
if !d.NextArg() {
|
if !d.NextArg() {
|
||||||
|
|
Loading…
Reference in a new issue