Skip to content

Commit

Permalink
Merge pull request #9 from marko-asplund/readme-updates
Browse files Browse the repository at this point in the history
Readme updates

* update badges
* describe how to run standalone with sbt
* show how to access via AWS CLI
* update snapshot version
  • Loading branch information
marko-asplund authored Dec 17, 2023
2 parents f412450 + a3d5bd0 commit 5560754
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# S3 mock library for Java/Scala

[![Build Status](https://travis-ci.org/findify/s3mock.svg?branch=master)](https://travis-ci.org/findify/s3mock)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.findify/s3mock_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.findify/s3mock_2.12)
![Build Status](https://github.com/marko-asplund/s3mock/actions/workflows/ci.yml/badge.svg)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.marko-asplund/s3mock_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.marko-asplund/s3mock_2.13)

s3mock is a web service implementing AWS S3 API, which can be used for local testing of your code using S3
but without hitting real S3 endpoints.
Expand Down Expand Up @@ -41,6 +41,11 @@ On maven, update your `pom.xml` in the following way:
</dependency>
```

S3Mock can be run as a standalone application from sbt:
```bash
runMain io.findify.s3mock.Main
```

S3Mock is also available as a [docker container](https://hub.docker.com/r/findify/s3mock/) for out-of-jvm testing:
```bash
docker run -p 8001:8001 findify/s3mock:latest
Expand Down Expand Up @@ -101,7 +106,7 @@ Scala with AWS S3 SDK:
import com.amazonaws.auth.AWSStaticCredentialsProvider
import com.amazonaws.auth.AnonymousAWSCredentials
import com.amazonaws.client.builder.AwsClientBuilder
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration
import com.amazonaws.services.s3.AmazonS3
import com.amazonaws.services.s3.AmazonS3Builder
import com.amazonaws.services.s3.AmazonS3Client
Expand Down Expand Up @@ -151,7 +156,7 @@ Scala with Pekko Connectors 1.0:
"pekko.connectors.s3.aws.credentials.access-key-id" -> "foo",
"pekko.connectors.s3.aws.credentials.secret-access-key" -> "bar",
"pekko.connectors.s3.aws.region.provider" -> "static",
"pekko.connectors.s3.aws.region.default-region" -> "us-east-1"
"pekko.connectors.s3.aws.region.default-region" -> "us-east-1"
).asJava)
implicit val system = ActorSystem.create("test", config)
implicit val mat = ActorMaterializer()
Expand All @@ -160,7 +165,23 @@ Scala with Pekko Connectors 1.0:
val contents = s3a.download("bucket", "key")._1.runWith(Sink.reduce[ByteString](_ ++ _)).map(_.utf8String)

```


AWS CLI:
```bash
export AWS_ACCESS_KEY_ID=foo
export AWS_SECRET_ACCESS_KEY=dummy
export AWS_SECRET_KEY=bar
export AWS_REGION=eu-north-1
export S3_ENDPOINT=http://localhost:8001

aws s3api create-bucket --bucket my-bucket --endpoint-url=$S3_ENDPOINT

aws s3api put-object --bucket my-bucket --key my-file --body ./my-file --endpoint-url=$S3_ENDPOINT

aws s3api get-object --bucket my-bucket --key my-file --endpoint-url=$S3_ENDPOINT my-file-output
```


## License

The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "s3mock"

version := "0.6.0-SNAPSHOT"
version := "0.7.0-SNAPSHOT"

scalaVersion in ThisBuild := "2.13.2"

Expand Down

0 comments on commit 5560754

Please sign in to comment.