Closed thisisaaronland closed 11 months ago
This seems like a big change to work around a method of providing credentials. Can you find another way to do this? Like providing an implementation of the pmtiles Bucket
with your custom blob module?
The issue would still be the same: Once compiled the pmtiles
command will have no knowledge of the custom implementation (be it a pmtiles.Bucket
or a blob.Bucket
) because it will not have been imported in main.go
.
All the PR does is move the core of the logic in main.go
in to a package that can be imported by external programs, which in turn can load custom or bespoke logic around buckets.
That said, looking at the PR above there do appear to be way more changes than what I've just described. I will investigate.
I would really prefer that you copy the necessary code from main.go
into your application. I don't envision a general need for reusing the code in main.go
- it should call what is eventually the "programmatic" API in the pmtiles/
module. Otherwise it becomes my job to create and maintain an entire 2nd API surface that is the logic in main.go
.
Fair enough.
This PR moves the guts of
main.go
in to aRun
method inapp/pmtiles/pmtiles.go
so that this code can be used with bespoke and customblob.Bucket
implementations. The originalmain.go
file remains and has been updated to callapp/pmtiles.Run()
.As a concrete example, I generally access S3 buckets using the
aaronland/gocloud-blob-s3
package which is a thin wrapper to create AWS session instances using named credentials strings not otherwise supported by the Go AWS packages. For example:Specifically
s3blob://BUCKET?prefix=point-in-polygon/®ion=REGION&credentials=session
Where
go-sfomuseum-pmtiles/cmd/pmtiles/main.go
looks like this:https://github.com/sfomuseum/go-sfomuseum-pmtiles/blob/app/cmd/pmtiles/main.go
I live for the day when I can retire
gocloud-blob-s3
but that is still not possible yet. The point of the PR is not to support that package specifically so much as customblob.Bucket
providers that people may want to use but that shouldn't be bundled inprotomaps/go-pmtiles
by default.