findify / s3mock

Embedded S3 server for easy mocking
MIT License
387 stars 107 forks source link

Could you please add posibility or describe workaround about DNS endpoint? #42

Closed C-h-e-r-r-y closed 7 years ago

C-h-e-r-r-y commented 7 years ago

From rademe file:

// use IP for endpoint address as AWS S3 SDK uses DNS-based bucket access scheme // resulting in attempts to connect to addresses like "bucketname.localhost" // which requires specific DNS setup

I have not tried to setup dns by mysefl but understand that it mat be not trivial. But do you know any workarounds to make "bucketname.localhost" working with your mock? If so could you please publish them in readme file? Because for now it is needed to create separate s3 client instance for integration tests and production code. :(

shuttie commented 7 years ago

But you can enable path style access in client and it should work with the hostnames this way:

val s3 = new AmazonS3Client(new AnonymousAWSCredentials())
s3.setEndpoint("http://localhost:8001")
s3.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build())

I'll update the docs to mention this.

shuttie commented 7 years ago

Done.