Skip to content

Commit

Permalink
Merge pull request #72 from /issues/68
Browse files Browse the repository at this point in the history
#68 | Kafka or Rabbitmq to be optional to use Clamp
  • Loading branch information
lohith46 authored Oct 29, 2020
2 parents 2036514 + c8df422 commit 24da675
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
CLAMP_DB_CONNECTION_STR: "host=localhost:5432 user=clamptest dbname=clamptest"
CLAMP_KAFKA_CONNECTION_STR: "localhost:9092"
CLAMP_QUEUE_CONNECTION_STR: "amqp://guest:guest@localhost:5672/"
ENABLE_KAFKA_INTEGRATION: true
ENABLE_AMQP_INTEGRATION: true
command: |
if [ $CIRCLE_BRANCH == 'master' ]; then
./cc-test-reporter before-build
Expand Down
3 changes: 3 additions & 0 deletions config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ var ENV = struct {
*/
PORT string `env:"APP_PORT" envDefault:"8080"`
AllowOrigins []string `env:"ALLOW_ORIGINS" envDefault:"http://localhost:3000,http://54.149.76.62"`

EnableKafkaIntegration bool `env:"ENABLE_KAFKA_INTEGRATION" envDefault:false`
EnableRabbitMQIntegration bool `env:"ENABLE_AMQP_INTEGRATION" envDefault:false`
}{}

func init() {
Expand Down
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ func main() {
os.Exit(0)
}

listeners.AmqpStepResponseListener.Listen()
listeners.KafkaStepResponseListener.Listen()
if config.ENV.EnableRabbitMQIntegration {
listeners.AmqpStepResponseListener.Listen()
}
if config.ENV.EnableKafkaIntegration {
listeners.KafkaStepResponseListener.Listen()
}
handlers.LoadHTTPRoutes()
log.Println("Calling listener")
}

0 comments on commit 24da675

Please sign in to comment.