Skip to content

Commit

Permalink
Add two environments for overriding endpoint and region
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hnakamur authored and benbjohnson committed May 10, 2022
1 parent 7d8b8c6 commit e6f7c60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions s3/replica_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e6f7c60

Please sign in to comment.