Sends notifications trough calls to rest interface.
Currently supports the following notification types:
How to use the running application
All request must inclue a header with the preshared key.
Authorization
: pre-shared: your...key
POST /mail
Json Request:
{
"to": "....",
"from": "....",
"subject": "....",
"body": "...."
}
Steps to run the application. this include configuration and key files at the moment
The application can be configured through a config file or environment variables. Environment variables take precedence.
config.toml can reside in your working directory, /etc/gotify/
or $HOME/.gotify/
port = "8080"
pre-shared-key = "......"
debug-mode = false
mock-mode = false
[google-mail]
keyfile = "gapps.json"
admin-mail = "admin@example.ex"
See Environment Variables for config explanation
GOTIFY_PORT
: Port for the web service, defaults to8080
(string)GOTIFY_PRE-SHARED-KEY
*: Random string used by other apps to authenticateGOTIFY_DEBUG-MODE
: Bool indicating debug mode defaults tofalse
GOTIFY_GOOGLE-MAIL.KEYFILE
: the file described in Google config file defaults togapps.json
GOTIFY_GOOGLE-MAIL.ADMIN-MAIL
*: The google administrator email.
This file (gapps.json by default config) should be placed in the working directory
(digIT can find this file on their wiki)
Go to Google developer console to retrieve this file
- go to credentials
- create new service account för this app
- use the downloaded file
You must also allow mail api calls:
- go to security > advanced settings > Manage API client access
- use the
client_id
from the credentials file previously retrieved - use api scope
https://www.googleapis.com/auth/gmail.send
You can either set this project up manually or with a simple docker compose setup. The manual setup is recommended if you'll be doing extensive development.
Please referer to the software design document before starting development: DESIGN.md
See issues for suggested features.
Make sure you have golang installed and you $GOPATH
setup.
- Follow the steps in Setup and enable debug mode.
- Grab all dependencies by standing in the project root and run
go get -d ./...
- You find the main file in
cmd/main.go
- Go to http://localhost:8080
Use gin for hot reloading.
- Grab it with
go get github.com/codegangsta/gin
- Run gotify with
gin -d cmd -a 8080 run main.go
- Go to http://localhost:3000
- Get a Google key file.
- Run
docker-compose up --build
- Go to http://localhost:8080
You can install additional dependencies without restarting the container by running docker exec gotify_web_1 go get ...
, gotify_web_1 is the name of the container and ... is the dependency.
- Set the
pre-shared-key
config/environment variable. - Set the
mock-mode
config/environment variable to true - Enjoy
Example docker-compose entry for mock service:
services:
...
gotify:
image: cthit/gotify:latest
environment:
GOTIFY_PRE-SHARED-KEY: "123abc"
GOTIFY_MOCK-MODE: "true"
Other services would then be able to reach this service on http://gotify:8080/...
with 123abc
as the preshared key