Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit c218db1

Browse files
maccacfiliphaftek
authored andcommitted
Tls support (#28)
* 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
1 parent bd46770 commit c218db1

File tree

12 files changed

+617
-17
lines changed

12 files changed

+617
-17
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o rabbit-amazon-for
1515
FROM alpine:3.8
1616

1717
RUN mkdir -p /config
18+
RUN mkdir -p /certs
1819
RUN apk --update upgrade && \
1920
apk add curl ca-certificates && \
2021
update-ca-certificates && \

Gopkg.lock

Lines changed: 155 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
branch = "master"
3838
name = "github.com/streadway/amqp"
3939

40+
[[override]]
41+
name = "gopkg.in/fsnotify.v1"
42+
source = "https://github.com/fsnotify/fsnotify/tree/v1.4.7"
43+
4044
[prune]
4145
go-tests = true
4246
unused-packages = true

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ export AWS_ACCESS_KEY_ID=access_key
5555
export AWS_SECRET_ACCESS_KEY=secret_key
5656
```
5757

58+
#### Using TLS with rabbit
59+
60+
Specify amqps for the rabbit connection ub the mapping file:
61+
```
62+
"connection" : "amqps://guest:guest@localhost:5671/",
63+
```
64+
65+
Additional environment variables for working with TLS and rabbit:
66+
```
67+
export CA_CERT=/certs/ca_certificate.pem
68+
export CERT_FILE=/certs/client_certificate.pem
69+
export KEY_FILE=/certs/client_key.pem
70+
```
71+
5872
### Amazon configuration
5973

6074
When making subscription to SNS -> SQS/HTTP/HTTPS set `Raw message delivery` to ensure that json messages are not escaped.

config/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package config
33
const (
44
// MappingFile mapping file environment variable
55
MappingFile = "MAPPING_FILE"
6+
CaCertFile = "CA_CERT_FILE"
7+
CertFile = "CERT_FILE"
8+
KeyFile = "KEY_FILE"
69
)
710

811
// RabbitEntry RabbitMQ mapping entry

0 commit comments

Comments
 (0)