You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,13 @@
2
2
3
3
This is a mini web server for listening for 2030.5 subscription notifications on behalf of [cactus-client](https://github.com/bsgip/cactus-client). It's designed to be hosted at a publicly available IP and will provide a running test instance with unique callback URIs that can be utilised for the duration of a test.
4
4
5
+
## PKI
6
+
7
+
This app is expected to be run downstream of TLS termination (eg behind an nginx reverse proxy).
8
+
9
+
Any mutual TLS / other considerations are expected to be managed at the point of TLS termination.
10
+
11
+
5
12
## Development
6
13
7
14
`pip install cactus_client_notifications` will install ONLY the schema dependencies (the default)
@@ -10,6 +17,40 @@ This is a mini web server for listening for 2030.5 subscription notifications on
10
17
11
18
`pip install cactus_client_notifications[server,dev,test]` will install ALL dependencies for development / tests
12
19
20
+
## Configuration
21
+
22
+
All configuration is managed via a series of environment variables. It's likely `SERVER_URL` and `MOUNT_POINT` are the only values you'll need to set for deployment.
23
+
24
+
| Environment Variable | Default Value | Description |
|`APP_PORT`|`8080`| What port the application will be listening on (reverse proxy target port) |
27
+
|`SERVER_URL`|`http://localhost:8080`| The public URI that all webhooks will be hosted under (This will need to be resolvable by BOTH the cactus CLI tool AND the utility server for submitting notifications) |
28
+
|`MOUNT_POINT`|`/`| If this service is hosted a path prefix (eg `/api/v12/`) set that value here. |
29
+
|`MAX_IDLE_DURATION_SECONDS`|`3600`| Any notification endpoint that hasn't been interacted with for this many seconds will be deleted |
30
+
|`MAX_DURATION_SECONDS`|`262800` (73 hours) | Any notification endpoint that is at least this old will be deleted |
31
+
|`MAX_ACTIVE_ENDPOINTS`|`1024`| The maximum number of endpoints that can be in existance at one time. |
32
+
|`MAX_ENDPOINT_NOTIFICATIONS`|`100`| The maximum number of (uncollected) notifications that an endpoint can hold |
33
+
|`CLEANUP_FREQUENCY_SECONDS`|`120`| How frequently the server checks for expired endpoints |
34
+
35
+
13
36
## Building
14
37
38
+
To build a Docker containerised version of the app - use the included Dockerfile:
If you want to run the built image (and host it at `my.server/api`):
43
+
44
+
`docker run -e SERVER_URL=https://my.server:8080 -e MOUNT_POINT=/api -p 8080:8080 cactus-client-notifications`
45
+
46
+
15
47
## API
48
+
49
+
| Method/Endpoint | Description | JSON Models |
50
+
| --------------- | ----------- | ----------- |
51
+
|`GET /manage`| Plaintext app status (eg: describing active endpoints and uncollected notifications) | Request: `None` Response: `None - plaintext`|
52
+
|`POST /manage/endpoint`| Attempts to create a notification endpoint. response will contain the unique notification endpoint ID and fully qualified URL | Request: `None` Response: `cactus_client_notifications.schema.CreateEndpointResponse`|
53
+
|`GET /manage/endpoint/{endpoint_id}`| Collects all Notifications for the nominated `endpoint_id`. Once a notification has been collected it will be cleared. | Request: `None` Response: `cactus_client_notifications.schema.CollectEndpointResponse`|
54
+
|`PUT /manage/endpoint/{endpoint_id}`| Updates the configuration for `endpoint_id` (eg enabling / disabling it).| Request: `cactus_client_notifications.schema.ConfigureEndpointRequest` Response: `None`|
55
+
|`DELETE /manage/endpoint/{endpoint_id}`| Requests the deletion of the endpoint with `endpoint_id`| Request: `None` Response: `None`|
56
+
|`* /webhook/{endpoint_id}`| The actual notification webhook that the utility server will be sending requests to. | Request: `Any` Response: `None`|
0 commit comments