mCaptcha/docs/CONFIGURATION.md

65 lines
3.2 KiB
Markdown
Raw Normal View History

2021-05-30 17:36:13 +03:00
# Configuration
2021-06-01 15:03:47 +03:00
mcaptcha is highly configurable.
2021-05-30 17:36:13 +03:00
Configuration is applied/merged in the following order:
2021-06-01 15:03:47 +03:00
1. path to configuration file passed in via `MCAPTCHA_CONFIG`
2021-05-30 17:36:13 +03:00
2. `./config/default.toml`
2021-06-01 15:03:47 +03:00
3. `/etc/mcaptcha/config.toml`
2021-05-30 17:36:13 +03:00
4. environment variables.
## Setup
### Environment variables:
Setting environment variables are optional. The configuration files have
all the necessary parameters listed. By setting environment variables,
you will be overriding the values set in the configuration files.
#### Database:
| Name | Value |
| ------------------------------------ | ------------------------------------------------------------- |
| `MCAPTCHA_DATEBASE_PASSWORD` | Postgres password |
| `MCAPTCHA_DATEBASE_NAME` | Postgres database name |
| `MCAPTCHA_DATEBASE_PORT` | Postgres port |
| `MCAPTCHA_DATEBASE_HOSTNAME` | Postgres hostmane |
| `MCAPTCHA_DATEBASE_USERNAME` | Postgres username |
| `MCAPTCHA_DATEBASE_POOL` | Postgres database connection pool size |
2021-05-30 17:36:13 +03:00
| `DATABSE_URL` (overrides above vars) | databse URL in `postgres://user:pass@host:port/dbname` format |
#### Redis:
| Name | Value |
| --------------------- | -------------------------- |
| `MCAPTCHA_REDIS_URL` | Redis URL |
| `MCAPTCHA_REDIS_POOL` | Redis connection pool size |
2021-05-30 17:36:13 +03:00
#### Server:
| Name | Value |
| ---------------------------------------- | ------------------------------------------------------ |
2021-06-01 15:03:47 +03:00
| `MCAPTCHA_SERVER_PORT` | The port on which you want mcaptcha to listen to |
| `PORT`(overrides `MCAPTCHA_SERVER_PORT`) | The port on which you want mcaptcha to listen to |
| `MCAPTCHA_SERVER_IP` | The IP address on which you want mcaptcha to listen to |
| `MCAPTCHA_SERVER_DOMAIN` | Domain under which mcaptcha will be\* |
| `MCAPTCHA_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random |
| `MCAPTCHA_SERVER_ALLOW_REGISTRATION` | `bool` that controls | | registration |
2021-06-01 15:03:47 +03:00
\* Authentication doesn't work without `MCAPTCHA_DOMAIN` set to the correct
2021-05-30 17:36:13 +03:00
domain
### Configuration file location:
| Name | Value |
| ----------------- | ------------------- |
2021-06-01 15:03:47 +03:00
| `MCAPTCHA_CONFIG` | Path to config file |
2021-05-30 17:36:13 +03:00
### Proof of work:
| Name | Value |
| ------------------- | --------------------------------------------------------------------------------------- |
2021-06-01 15:03:47 +03:00
| `MCAPTCHA_POW_SALT` | Salt has to be long and random |
| `MCAPTCHA_POW_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point |