From e6f7c6052d84b7265fd54d3a3ab33208948e126b Mon Sep 17 00:00:00 2001 From: Hiroaki Nakamura Date: Tue, 10 May 2022 19:18:31 +0900 Subject: [PATCH] Add two environments for overriding endpoint and region export LITESTREAM_ACCESS_KEY_ID=your_key_id export LITESTREAM_SECRET_ACCESS_KEY=your_access_key export LITESTREAM_ENDPOINT=your_endpoint export LITESTREAM_REGION=your_region litestream replicate fruits.db s3://mybkt/fruits.db --- s3/replica_client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/s3/replica_client.go b/s3/replica_client.go index 182d713..d551288 100644 --- a/s3/replica_client.go +++ b/s3/replica_client.go @@ -703,6 +703,13 @@ func ParseHost(s string) (bucket, region, endpoint string, forcePathStyle bool) endpoint = net.JoinHostPort(endpoint, port) } + if e := os.Getenv("LITESTREAM_ENDPOINT"); e != "" { + endpoint = e + } + if r := os.Getenv("LITESTREAM_REGION"); r != "" { + region = r + } + // Prepend scheme to endpoint. if endpoint != "" { endpoint = scheme + "://" + endpoint