|
| 1 | +# Topcoder x receiver configuration |
| 2 | +The following config parameters are supported, they are defined in `config/default.js` and can be configured in env variables: |
| 3 | + |
| 4 | + |
| 5 | +| Name | Description | Default | |
| 6 | +| :------------------------------------- | :----------------------------------------: | :------------------------------: | |
| 7 | +| PORT | The port the application will listen on | 3002 | |
| 8 | +| LOG_LEVEL | The log level | info | |
| 9 | +| MONGODB_URI | The MongoDB URI. This needs to be the same MongoDB used by topcoder-x-receiver, topcoder-x-processor, and topcoder-x-site | mongodb://127.0.0.1:27017/topcoderx | |
| 10 | +|TOPIC | The Kafka topic where events are published. This must be the same as the configured value for topcoder-x-processor| | |
| 11 | +|KAFKA_OPTIONS | Kafka connection options| | |
| 12 | +|KAFKA_HOST | The Kafka host to connect to| localhost:9092 | |
| 13 | +|KAFKA_CLIENT_CERT | The Kafka SSL certificate to use when connecting| Read from kafka_client.cer file, but this can be set as a string like it is on Heroku | |
| 14 | +|KAFKA_CLIENT_CERT_KEY | The Kafka SSL certificate key to use when connecting| Read from kafka_client.key file, but this can be set as a string like it is on Heroku| |
| 15 | + |
| 16 | +KAFKA_OPTIONS should be object as described in https://github.com/SOHU-Co/kafka-node#kafkaclient |
| 17 | +For using with SSL, the options should be as |
| 18 | +``` |
| 19 | + { |
| 20 | + kafkaHost: '<server>', |
| 21 | + sslOptions: { |
| 22 | + cert: '<certificate>', |
| 23 | + key: '<key>' |
| 24 | + } |
| 25 | + } |
| 26 | +``` |
| 27 | + |
| 28 | +## Endpoints |
| 29 | + |
| 30 | +- POST /webhooks/github - The webhook handler for github |
| 31 | +- POST /webhooks/gitlab - The webhook handler for gitlab |
| 32 | + |
| 33 | +## Github Verification |
| 34 | + |
| 35 | +#### Webhook configuration |
| 36 | + |
| 37 | +Configure a Github project with a webhook with a format like this: https://<receiver URL>:<receiver port>/webhooks/github |
| 38 | + |
| 39 | +#### Smoke test |
| 40 | +- Create an issue in the repo, you can see the logs in `receiver`, the `issue.created` event is generated. |
| 41 | + |
| 42 | +You can test other events, but just validating that an issue.created event is generated in Kafka is enough to smoke test the receiver is set up properly. |
| 43 | + |
| 44 | +#### Debugging |
| 45 | +You can re-run and debug the responses to webhook requests on Github, in the configuration for the webhook. This can be useful if things aren't coming through properly in the receiver. |
| 46 | + |
| 47 | +## Github Verification |
| 48 | + |
| 49 | +#### Webhook configuration |
| 50 | + |
| 51 | +Configure a Gitlab project with a webhook with a format like this: https://<receiver URL>:<receiver port>/webhooks/gitlab |
| 52 | + |
| 53 | +#### Smoke test |
| 54 | +- Create an issue in the repo, you can see the logs in `receiver`, the `issue.created` event is generated. |
| 55 | + |
| 56 | +You can test other events, but just validating that an issue.created event is generated in Kafka is enough to smoke test the receiver is set up properly. |
| 57 | + |
| 58 | +#### Debugging |
| 59 | +You can re-run and debug the responses to webhook requests on Gitlab, in the configuration for the webhook. This can be useful if things aren't coming through properly in the receiver. |
0 commit comments