From bac8bf44dd4dea0b7d0437de314fa3ee80e7a661 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Sat, 10 Feb 2024 14:30:35 -0500 Subject: [PATCH] fix --- caddy/pmtiles_proxy.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/caddy/pmtiles_proxy.go b/caddy/pmtiles_proxy.go index 0c2cb6d..e237bc1 100644 --- a/caddy/pmtiles_proxy.go +++ b/caddy/pmtiles_proxy.go @@ -2,6 +2,12 @@ package caddy import ( "fmt" + "io" + "log" + "net/http" + "strconv" + "time" + "github.com/caddyserver/caddy/v2" "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" @@ -12,11 +18,6 @@ import ( _ "gocloud.dev/blob/fileblob" _ "gocloud.dev/blob/gcsblob" _ "gocloud.dev/blob/s3blob" - "io" - "log" - "net/http" - "strconv" - "time" ) func init() { @@ -29,6 +30,7 @@ type Middleware struct { Bucket string `json:"bucket"` CacheSize int `json:"cache_size"` PublicURL string `json:"public_url"` + TileEtag bool `json:"tile_etag"` logger *zap.Logger server *pmtiles.Server } @@ -45,7 +47,7 @@ func (m *Middleware) Provision(ctx caddy.Context) error { m.logger = ctx.Logger() logger := log.New(io.Discard, "", log.Ldate) prefix := "." // serve only the root of the bucket for now, at the root route of Caddyfile - server, err := pmtiles.NewServer(m.Bucket, prefix, logger, m.CacheSize, "", m.PublicURL) + server, err := pmtiles.NewServer(m.Bucket, prefix, logger, m.CacheSize, "", m.PublicURL, m.TileEtag) if err != nil { return err }