Skip to content

Commit

Permalink
Tls support (#28)
Browse files Browse the repository at this point in the history
* Adding support for amqp tls connections

* Correcting spacing in the config.go file

* Checking what travis ci gives as a docker version

* Working around a docker-compose bug that prevents  empty defaults

* removed docker-compose version check

This was being used for debugging a build failure and is no
longer needed

* Making a rabbit mq connector that should be more testable in theoryr

* Refactors and initial tests around CreateConnector

- Added ginkgo and gomega for testing
- Test that a connector of the correct type is created
- Moved the instantiation of the connector into mapping.go
- Added a test to mapping.go to assert that the created connector is non nil
- Renamed config on TlsRabbitConnector to config to reduce confusion around
  the config package

* Adding some happy case tests

* Removed some debug calls that were added by accident

* Adding more test coverage

* Adding test coverage around the tls connector

* Switch to using HasPrefix and add additional test coverage around the basic connector
  • Loading branch information
maccac authored and filiphaftek committed Nov 27, 2018
1 parent bd46770 commit c218db1
Show file tree
Hide file tree
Showing 12 changed files with 617 additions and 17 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o rabbit-amazon-for
FROM alpine:3.8

RUN mkdir -p /config
RUN mkdir -p /certs
RUN apk --update upgrade && \
apk add curl ca-certificates && \
update-ca-certificates && \
Expand Down
158 changes: 155 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
branch = "master"
name = "github.com/streadway/amqp"

[[override]]
name = "gopkg.in/fsnotify.v1"
source = "https://github.com/fsnotify/fsnotify/tree/v1.4.7"

[prune]
go-tests = true
unused-packages = true
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ export AWS_ACCESS_KEY_ID=access_key
export AWS_SECRET_ACCESS_KEY=secret_key
```

#### Using TLS with rabbit

Specify amqps for the rabbit connection ub the mapping file:
```
"connection" : "amqps://guest:guest@localhost:5671/",
```

Additional environment variables for working with TLS and rabbit:
```
export CA_CERT=/certs/ca_certificate.pem
export CERT_FILE=/certs/client_certificate.pem
export KEY_FILE=/certs/client_key.pem
```

### Amazon configuration

When making subscription to SNS -> SQS/HTTP/HTTPS set `Raw message delivery` to ensure that json messages are not escaped.
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package config
const (
// MappingFile mapping file environment variable
MappingFile = "MAPPING_FILE"
CaCertFile = "CA_CERT_FILE"
CertFile = "CERT_FILE"
KeyFile = "KEY_FILE"
)

// RabbitEntry RabbitMQ mapping entry
Expand Down
Loading

0 comments on commit c218db1

Please sign in to comment.