|
6 | 6 | - Heroku Toolbelt https://toolbelt.heroku.com
|
7 | 7 | - git
|
8 | 8 | - PostgreSQL 9.5
|
9 |
| - |
| 9 | + |
10 | 10 |
|
11 | 11 | ## Configuration
|
| 12 | + |
| 13 | +### Notification server |
12 | 14 | Configuration for the notification server is at `config/default.js`.
|
13 | 15 | The following parameters can be set in config files or in env variables:
|
14 |
| -- LOG_LEVEL: the log level |
15 |
| -- PORT: the notification server port |
16 |
| -- AUTH_SECRET: TC auth secret |
17 |
| -- VALID_ISSUERS: TC auth valid issuers |
18 |
| -- jwksUri: TC auth JWKS URI |
19 |
| -- DATABASE_URL: URI to PostgreSQL database |
20 |
| -- DATABASE_OPTIONS: database connection options |
21 |
| -- KAFKA_URL: comma separated Kafka hosts |
22 |
| -- KAFKA_TOPIC_IGNORE_PREFIX: ignore this prefix for topics in the Kafka |
23 |
| -- KAFKA_GROUP_ID: Kafka consumer group id |
24 |
| -- KAFKA_CLIENT_CERT: Kafka connection certificate, optional; |
25 |
| - if not provided, then SSL connection is not used, direct insecure connection is used; |
26 |
| - if provided, it can be either path to certificate file or certificate content |
27 |
| -- KAFKA_CLIENT_CERT_KEY: Kafka connection private key, optional; |
28 |
| - if not provided, then SSL connection is not used, direct insecure connection is used; |
29 |
| - if provided, it can be either path to private key file or private key content |
30 |
| -- BUS_API_BASE_URL: Bus API url |
31 |
| -- REPLY_EMAIL_PREFIX: prefix of the genereated reply email address |
32 |
| -- REPLY_EMAIL_DOMAIN: email domain |
33 |
| -- DEFAULT_REPLY_EMAIL: default reply to email address, for example no-reply@topcoder.com |
34 |
| -- MENTION_EMAIL: recipient email used for email.project.post.mention event |
35 |
| - |
| 16 | +- **General** |
| 17 | + - `LOG_LEVEL`: the log level |
| 18 | + - `PORT`: the notification server port |
| 19 | + - `DATABASE_URL`: URI to PostgreSQL database |
| 20 | + - `DATABASE_OPTIONS`: database connection options |
| 21 | +- **JWT authentication** |
| 22 | + - `AUTH_SECRET`: TC auth secret |
| 23 | + - `VALID_ISSUERS`: TC auth valid issuers |
| 24 | + - `JWKS_URI`: TC auth JWKS URI (need only for local deployment) |
| 25 | +- **KAFKA** |
| 26 | + - `KAFKA_URL`: comma separated Kafka hosts |
| 27 | + - `KAFKA_TOPIC_IGNORE_PREFIX`: ignore this prefix for topics in the Kafka |
| 28 | + - `KAFKA_GROUP_ID`: Kafka consumer group id |
| 29 | + - `KAFKA_CLIENT_CERT`: Kafka connection certificate, optional; |
| 30 | + if not provided, then SSL connection is not used, direct insecure connection is used; |
| 31 | + if provided, it can be either path to certificate file or certificate content |
| 32 | + - `KAFKA_CLIENT_CERT_KEY`: Kafka connection private key, optional; |
| 33 | + if not provided, then SSL connection is not used, direct insecure connection is used; |
| 34 | + if provided, it can be either path to private key file or private key content |
| 35 | +- **Topcoder API** |
| 36 | + - `TC_API_V5_BASE_URL`: the TopCoder API V5 base URL |
| 37 | +- **Notifications API** |
| 38 | + - `API_CONTEXT_PATH`: path to serve API on |
| 39 | +- **Machine to machine auth0 token** |
| 40 | + - `AUTH0_URL`: auth0 URL |
| 41 | + - `AUTH0_AUDIENCE`: auth0 audience |
| 42 | + - `TOKEN_CACHE_TIME`: time period of the cached token |
| 43 | + - `AUTH0_CLIENT_ID`: auth0 client id |
| 44 | + - `AUTH0_CLIENT_SECRET`: auth0 client secret |
| 45 | + |
| 46 | +### Connect notification server |
36 | 47 | Configuration for the connect notification server is at `connect/config.js`.
|
37 | 48 | The following parameters can be set in config files or in env variables:
|
38 |
| -- TC_API_V3_BASE_URL: the TopCoder API V3 base URL |
39 |
| -- TC_API_V4_BASE_URL: the TopCoder API V4 base URL |
40 |
| -- TC_ADMIN_TOKEN: the admin token to access TopCoder API - same for V3 and V4<br> |
41 |
| - Also it has probably temporary variables of TopCoder role ids for 'Connect Manager', 'Connect Copilot' and 'administrator': |
42 |
| -- CONNECT_MANAGER_ROLE_ID: 8, |
43 |
| -- CONNECT_COPILOT_ROLE_ID: 4, |
44 |
| -- ADMINISTRATOR_ROLE_ID: 1<br> |
45 |
| - Provided values are for development backend. For production backend they may be different. |
46 |
| - These variables are currently being used to retrieve above role members using API V3 `/roles` endpoint. As soon as this endpoint is replaced with more suitable one, these variables has to be removed if no need anymore. |
47 |
| -- TCWEBSERVICE_ID - id of the BOT user which creates post with various events in discussions |
48 |
| - |
| 49 | +- **Topcoder API** |
| 50 | + - `TC_API_V3_BASE_URL`: the TopCoder API V3 base URL |
| 51 | + - `TC_API_V4_BASE_URL`: the TopCoder API V4 base URL |
| 52 | + - `MESSAGE_API_BASE_URL`: the TopCoder message service API base URL |
| 53 | + - `TC_ADMIN_TOKEN`: the admin token to access TopCoder API - same for V3 and V4 |
| 54 | +- **Topcder specific**<br> |
| 55 | + Also it has probably temporary variables of TopCoder role ids for 'Connect Manager', 'Connect Copilot' and 'administrator': |
| 56 | + - `CONNECT_MANAGER_ROLE_ID`: 8, |
| 57 | + - `CONNECT_COPILOT_ROLE_ID`: 4, |
| 58 | + - `ADMINISTRATOR_ROLE_ID`: 1<br> |
| 59 | + Provided values are for development backend. For production backend they may be different. |
| 60 | + These variables are currently being used to retrieve above role members using API V3 `/roles` endpoint. As soon as this endpoint is replaced with more suitable one, these variables has to be removed if no need anymore. |
| 61 | + - `TCWEBSERVICE_ID` - id of the BOT user which creates post with various events in discussions |
| 62 | +- **Machine to machine auth0 token** |
| 63 | + - `AUTH0_URL`: auth0 URL |
| 64 | + - `AUTH0_AUDIENCE`: auth0 audience |
| 65 | + - `TOKEN_CACHE_TIME`: time period of the cached token |
| 66 | + - `AUTH0_CLIENT_ID`: auth0 client id |
| 67 | + - `AUTH0_CLIENT_SECRET`: auth0 client secret |
| 68 | +- **Email notification service** |
| 69 | + - `ENV`: environment variable (used to generate reply emails) |
| 70 | + - `AUTH_SECRET`: auth secret (used to sign reply emails) |
| 71 | + - `ENABLE_EMAILS`: if email service has to be enabled |
| 72 | + - `ENABLE_DEV_MODE`: send all emails to the `DEV_MODE_EMAIL` email address |
| 73 | + - `DEV_MODE_EMAIL`: address to send all email when `ENABLE_DEV_MODE` is enabled |
| 74 | + - `MENTION_EMAIL`: recipient email used for `notifications.action.email.connect.project.post.mention` event |
| 75 | + - `REPLY_EMAIL_PREFIX`: prefix of the genereated reply email address |
| 76 | + - `REPLY_EMAIL_DOMAIN`: email domain |
| 77 | + - `DEFAULT_REPLY_EMAIL`: default reply to email address, for example no-reply@topcoder.com |
49 | 78 |
|
50 | 79 | Note that the above two configuration are separate because the common notification server config
|
51 | 80 | will be deployed to a NPM package, the connect notification server will use that NPM package,
|
@@ -89,6 +118,11 @@ In case it expires, you may get a new token in this way:
|
89 | 118 | - `TC_API_V3_BASE_URL=https://api.topcoder-dev.com/v3`
|
90 | 119 | - `TC_ADMIN_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIiwiYWRtaW5pc3RyYXRvciJdLCJpc3MiOiJodHRwczovL2FwaS50b3Bjb2Rlci1kZXYuY29tIiwiaGFuZGxlIjoic3VzZXIxIiwiZXhwIjoxNTEzNDAxMjU4LCJ1c2VySWQiOiI0MDE1MzkzOCIsImlhdCI6MTUwOTYzNzYzOSwiZW1haWwiOiJtdHdvbWV5QGJlYWtzdGFyLmNvbSIsImp0aSI6IjIzZTE2YjA2LWM1NGItNDNkNS1iY2E2LTg0ZGJiN2JiNDA0NyJ9.REds35fdBvY7CMDGGFyT_tOD7DxGimFfVzIyEy9YA0Y` or follow section **TC API Admin Token** to obtain a new one if expired
|
91 | 120 | - `KAFKA_URL`, `KAFKA_CLIENT_CERT` and `KAFKA_CLIENT_CERT_KEY` get from [tc-bus-api readme](https://github.com/topcoder-platform/tc-bus-api/tree/dev)
|
| 121 | +- if you are willing to use notifications API which is hosted by the notifications server locally, you will need to use some patched `tc-core-library-js` module, which skips verification of user token. Because we don't know Topcoder `AUTH_SECRET` locally. So you can install this fork: |
| 122 | + ``` |
| 123 | + npm i https://github.com/maxceem/tc-core-library-js/tree/skip-validation |
| 124 | + ``` |
| 125 | + **WARNING** do not push package.json with this dependency as it skips users token validation. |
92 | 126 | - start local PostgreSQL db, create an empty database, update the config/default.js DATABASE_URL param to point to the db
|
93 | 127 | - install dependencies `npm i`
|
94 | 128 | - run code lint check `npm run lint`
|
@@ -127,5 +161,5 @@ In case it expires, you may get a new token in this way:
|
127 | 161 | ## Swagger
|
128 | 162 |
|
129 | 163 | Swagger API definition is provided at `docs/swagger_api.yaml`,
|
130 |
| -you may check it at `http://editor.swagger.io`. |
| 164 | +you may check it at `http://editor.swagger.io`. |
131 | 165 |
|
0 commit comments