Skip to content

Commit 24da675

Browse files
authored
Merge pull request #72 from /issues/68
#68 | Kafka or Rabbitmq to be optional to use Clamp
2 parents 2036514 + c8df422 commit 24da675

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ jobs:
6565
CLAMP_DB_CONNECTION_STR: "host=localhost:5432 user=clamptest dbname=clamptest"
6666
CLAMP_KAFKA_CONNECTION_STR: "localhost:9092"
6767
CLAMP_QUEUE_CONNECTION_STR: "amqp://guest:guest@localhost:5672/"
68+
ENABLE_KAFKA_INTEGRATION: true
69+
ENABLE_AMQP_INTEGRATION: true
6870
command: |
6971
if [ $CIRCLE_BRANCH == 'master' ]; then
7072
./cc-test-reporter before-build

config/env.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ var ENV = struct {
4545
*/
4646
PORT string `env:"APP_PORT" envDefault:"8080"`
4747
AllowOrigins []string `env:"ALLOW_ORIGINS" envDefault:"http://localhost:3000,http://54.149.76.62"`
48+
49+
EnableKafkaIntegration bool `env:"ENABLE_KAFKA_INTEGRATION" envDefault:false`
50+
EnableRabbitMQIntegration bool `env:"ENABLE_AMQP_INTEGRATION" envDefault:false`
4851
}{}
4952

5053
func init() {

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ func main() {
1919
os.Exit(0)
2020
}
2121

22-
listeners.AmqpStepResponseListener.Listen()
23-
listeners.KafkaStepResponseListener.Listen()
22+
if config.ENV.EnableRabbitMQIntegration {
23+
listeners.AmqpStepResponseListener.Listen()
24+
}
25+
if config.ENV.EnableKafkaIntegration {
26+
listeners.KafkaStepResponseListener.Listen()
27+
}
2428
handlers.LoadHTTPRoutes()
2529
log.Println("Calling listener")
2630
}

0 commit comments

Comments
 (0)