2023-02-05 15:27:39 +01:00
|
|
|
# remindrs
|
2023-01-23 23:36:03 +01:00
|
|
|
|
2023-02-16 15:53:18 +01:00
|
|
|
Send an email at a given time. The basic purpose of remindrs is to
|
|
|
|
send a reminder email containing a certain title and message.
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
There are two basic steps to install remindrs. First it is recomended
|
2023-02-16 16:10:26 +01:00
|
|
|
to prepare the Database. Then build the binary or build and install
|
2023-02-16 15:53:18 +01:00
|
|
|
the Debian package.
|
|
|
|
|
|
|
|
### Database
|
|
|
|
|
2023-02-16 16:10:26 +01:00
|
|
|
Prepare an empty Postgres database preferably together with an
|
2023-02-16 16:20:09 +01:00
|
|
|
separate user. The database schema creation and updates are done
|
2023-02-16 16:16:22 +01:00
|
|
|
automatically for each change.
|
2023-02-16 15:53:18 +01:00
|
|
|
|
|
|
|
### Building
|
|
|
|
|
2023-02-16 16:10:26 +01:00
|
|
|
Remindrs can be built in two ways. By using the classic Rust toolchain
|
|
|
|
to build a binary. Or by using
|
2023-02-16 15:53:18 +01:00
|
|
|
[`cargo-deb`](https://github.com/kornelski/cargo-deb) to build a
|
|
|
|
Debian package.
|
|
|
|
|
|
|
|
For both ways a Postgres database is mandatory.
|
|
|
|
|
|
|
|
#### With the Rust toolchain
|
|
|
|
|
|
|
|
In order to build just the remindrs binary with the standard Rust
|
|
|
|
toolchain build it with cargo:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
cargo build
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Debian package
|
|
|
|
|
|
|
|
In order to build the remindrs Debian package use
|
|
|
|
[`cargo-deb`](https://github.com/kornelski/cargo-deb):
|
|
|
|
|
|
|
|
```sh
|
|
|
|
cargo deb
|
|
|
|
```
|
|
|
|
|
|
|
|
The generated Debian package also installs a systemd service unit, but
|
2023-02-16 16:10:26 +01:00
|
|
|
does not enable it by default in order to prepare the configuration
|
|
|
|
first.
|
2023-02-16 15:53:18 +01:00
|
|
|
|
|
|
|
#### Configuraion
|
|
|
|
|
2023-02-16 16:10:26 +01:00
|
|
|
When remindrs is started it tries to load the configuration either
|
|
|
|
from the path passed as the command line argument `-c`/`--config`, or
|
|
|
|
by the default paths. Those are `./config.toml`,
|
2023-02-16 15:53:18 +01:00
|
|
|
`$XDG_CONFIG_HOME/remindrs/config.toml` or
|
|
|
|
`$HOME/.config/remindrs/config.toml` if `$XDG_CONFIG_HOME` is not set,
|
|
|
|
and finally `/etc/remindrs/config.toml`.
|
|
|
|
|
2023-02-16 16:10:26 +01:00
|
|
|
To configure remindrs the following configuration options are
|
|
|
|
available.
|
|
|
|
|
|
|
|
> Note that all options that are commented out have the given
|
|
|
|
> parameter as a default value and are not mandatory.
|
2023-02-16 15:53:18 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
[database]
|
|
|
|
# host = "localhost"
|
|
|
|
# port = 5432
|
|
|
|
# name = "remindrs"
|
|
|
|
# user = "remindrs"
|
|
|
|
pass = "remindrs"
|
|
|
|
|
|
|
|
# [server]
|
|
|
|
# address = "::1"
|
|
|
|
# port = 8080
|
|
|
|
|
|
|
|
# [email]
|
|
|
|
# from = "remindrs@localhost"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
The configuration is mostly done via the configuration file. When
|
|
|
|
remindrs is running the only way to interact with it is via the API.
|
|
|
|
|
|
|
|
### Command line arguments
|
|
|
|
|
|
|
|
The binary supports only a small set of command line arguments.
|
|
|
|
|
|
|
|
```
|
|
|
|
Usage: remindrs [OPTIONS]
|
|
|
|
|
|
|
|
Options:
|
|
|
|
-c, --config <FILE> Use a custom config file
|
|
|
|
-l, --log-level <LEVEL> Set a log level [default: INFO]
|
|
|
|
-h, --help Print help
|
|
|
|
-V, --version Print version
|
|
|
|
```
|
|
|
|
|
|
|
|
### API
|
|
|
|
|
|
|
|
In order to create a reminder send a `POST` request to the API
|
|
|
|
endpoint.
|
|
|
|
|
2023-02-16 16:10:26 +01:00
|
|
|
This may be done for example with `curl` like the following:
|
2023-02-16 15:53:18 +01:00
|
|
|
|
|
|
|
```sh
|
|
|
|
curl -X POST localhost:8080/v1/reminder \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d '{"planned":"2023-02-02T14:16:00.000000000+07:00", "title":"test title", "message":"test message", "receiver":"user@localhost"}'
|
|
|
|
```
|