Closed mikeseese closed 2 years ago
Thanks for the info, I'll take a peek once time permits, hopefully within a week or two. I don't have any of the non-AWS S3 buckets so testing might be an issue, would you be willing to test some stuff out once I have something @seesemichaelj ?
Absolutely!
@seesemichaelj Please try out https://github.com/DanEngelbrecht/golongtail/releases/tag/v0.3.4-pre14 and see how the new option feels and works out.,
@DanEngelbrecht I can confirm that v0.3.4-pre14
works with DigitalOcean S3 Spaces using the --s3-endpoint-resolver-uri https://sfo3.digitaloceanspaces.com
as the endpoint configuration (and specifying the region, key, and secret variables via AWS config files and environment variables). Awesome, thank you!
To be able to use non-AWS S3 buckets (Cloudflare R2, DigitalOcean Spaces, etc), you need to specify a custom endpoint URI. Unfortunately, the AWS SDK doesn't provide an environment or config file variable to override this value (https://github.com/aws/aws-cli/issues/4454); it only supports a CLI parameter or using the direct SDK variable). So for longtail to support these custom endpoints, the SDK references would need to be changed
Using the docs here, here, here, and here, I believe that https://github.com/DanEngelbrecht/golongtail/blob/883905db7a273e0bd58bc3c5cdb5cf98eda3d8e5/longtailstorelib/s3Store.go#L60 can be modified to look something like (please excuse my lack of golang experience):
or
where
ConfiguredBaseEndpointUri
could be some new CLI flag (i.e.--s3-base-endpoint
).It's also very possible that it's as simple as the below (I've seen another example say
aws.Config
hasEndpoint
, but the official docs say otherwise)Once the endpoint can be configured, users can configure the region and credentials using the
~/.aws/config
and~/.aws/credentials
files mentioned in longtail's readme or useAWS_REGION
,AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
, andAWS_SESSION_TOKEN
environment variables (which get read in during theLoadDefaultConfig
call, so there's no reason to make any changes to support those variables.I would attempt to implement this myself and make a PR, but my golang experience is measured in weeks and I would likely just be going down a rabbithole for simple issues