This repo contains the source for the messaging service, part of Sidings Media's public API
This project is written in go so you will need this to be installed.
First download the project dependencies.
go mod download
And then you can compile the binary.
go build -a -o server
This will require docker to be installed. After you have installed docker, you need to run only one command to build the container.
docker build . -t messaging:latest
Note: -t messaging
gives the container the name messaging and the tag
latest.
Docker will now download all the dependencies and then build your container. This may take a while.
This service requires certain environment variables in order to function
correctly. An example .env
file can be found in the document root
(.env.example
). Below is a complete table of all environment
variables.
Name | Required | Description | Example |
---|---|---|---|
BIND_ADDR |
❌ | This is the address to bind the server to. Defaults to [::1]:3000 . |
[::]:3000 |
TRUSTED_PROXIES |
❌ | Proxy servers to trust when reading client IP headers. Provide addresses in a comma separated list.Defaults to * . |
192.0.2.1,192.0.2.2,2001:db8::1,2001:db8::2 |
GIN_MODE |
❌ | Mode to run Gin in. Only set to debug for development. Defaults to release . |
release |
TICKET_API_URL |
✔️ | URL of endpoint to call when submitting a ticket. | https://tickets.example.com/api/tickets.json |
TICKET_HEALTH_URL |
✔️ | URL of endpoint to call for health checks on the ticketing system. | https://tickets.example.com |
TICKET_API_KEY |
✔️ | API key to pass in X-API-Key header to server. |
|
TICKET_SHOULD_ALERT |
❌ | Should an alert be sent by ticketing system to agents? Defaults to true . |
|
TICKET_SHOULD_AUTORESPOND |
❌ | Should an autoresponse email be sent to the user? Defaults to true . |
|
TICKET_SOURCE |
❌ | Source of message to show in ticketing system. Defaults to API . |
API |
If you are using the binary to run the service, you have two options for setting the environment variables. One is to actually set them on the system, the other option is to store the settings in a .env file which will be automatically loaded on start.
docker run --publish 3000:3000 -d --name messaging ghcr.io/sidingsmedia/messaging
To add the environment variables, you can use multiple -e
flags. For
more information see the docker
documentation.
A docker compose file is also provided if you would like to use it.
docker compose up . -d
To pass the environment variables, just store them in a .env file.
This repo uses the REUSE standard in order to
communicate the correct licence for the file. For those unfamiliar with
the standard the licence for each file can be found in one of three
places. The licence will either be in a comment block at the top of the
file, in a .license
file with the same name as the file, or in the
dep5 file located in the .reuse
directory. If you are unsure of the
licencing terms please contact
contact@sidingsmedia.com.
All files committed to this repo must contain valid licencing
information or the pull request can not be accepted.