configuration instructions

This commit is contained in:
realaravinth 2021-05-30 20:06:13 +05:30
parent f4deb20fbc
commit 8486f3be04
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
3 changed files with 61 additions and 36 deletions

View file

@ -90,7 +90,7 @@ It takes a while to build the image so please be patient :)
## Development:
See [HADCKING.md](./docs/HACKING.md)
See [HACKING.md](./docs/HACKING.md)
## Deployment:
@ -98,38 +98,4 @@ See [DEPLOYMENT.md](./docs/DEPLOYMET.md)
## Configuration:
Guard is highly configurable.
Configuration is applied/merged in the following order:
1. path to configuration file passed in via `GUARD_CONFIG`
2. `./config/default.toml`
3. `/etc/guard/config.toml`
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 |
| ------------------------- | -------------------------------------- |
| `GUARD_DATEBASE_PASSWORD` | Postgres password |
| `GUARD_DATEBASE_NAME` | Postgres database name |
| `GUARD_DATEBASE_PORT` | Postgres port |
| `GUARD_DATEBASE_HOSTNAME` | Postgres hostmane |
| `GUARD_DATEBASE_USERNAME` | Postgres username |
| `GUARD_DATEBASE_POOL` | Postgres database connection pool size |
##### Server:
| Name | Value |
| ----------------------------------- | --------------------------------------------------- |
| `GUARD_SERVER_PORT` (or) `PORT`\*\* | The port on which you want wagon to listen to |
| `GUARD_SERVER_IP` | The IP address on which you want wagon to listen to |
| `GUARD_SERVER_STATIC_FILES_DIR` | Path to directory containing static files |
| `GUARD_CONFIG` | Path to config file |
See [CONFIGURATION.md](./docs/CONFIGURATION.md)

57
docs/CONFIGURATION.md Normal file
View file

@ -0,0 +1,57 @@
# Configuration
Guard is highly configurable.
Configuration is applied/merged in the following order:
1. path to configuration file passed in via `GUARD_CONFIG`
2. `./config/default.toml`
3. `/etc/guard/config.toml`
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 |
| ------------------------------------ | ------------------------------------------------------------- |
| `GUARD_DATEBASE_PASSWORD` | Postgres password |
| `GUARD_DATEBASE_NAME` | Postgres database name |
| `GUARD_DATEBASE_PORT` | Postgres port |
| `GUARD_DATEBASE_HOSTNAME` | Postgres hostmane |
| `GUARD_DATEBASE_USERNAME` | Postgres username |
| `GUARD_DATEBASE_POOL` | Postgres database connection pool size |
| `DATABSE_URL` (overrides above vars) | databse URL in `postgres://user:pass@host:port/dbname` format |
#### Server:
| Name | Value |
| ------------------------------------- | --------------------------------------------------- |
| `GUARD_SERVER_PORT` | The port on which you want guard to listen to |
| `PORT`(overrides `GUARD_SERVER_PORT`) | The port on which you want guard to listen to |
| `GUARD_SERVER_IP` | The IP address on which you want guard to listen to |
| `GUARD_SERVER_DOMAIN` | Domain under which guard will be\* |
| `GUARD_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random |
| `GUARD_SERVER_ALLOW_REGISTRATION` | `bool` that controls | | registration |
\* Authentication doesn't work without `GUARD_DOMAIN` set to the correct
domain
### Configuration file location:
| Name | Value |
| -------------- | ------------------- |
| `GUARD_CONFIG` | Path to config file |
### Proof of work:
| Name | Value |
| ---------------- | --------------------------------------------------------------------------------------- |
| `GUARD_POW_SALT` | Salt has to be long and random |
| `GUARD_POW_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point |

View file

@ -1,5 +1,7 @@
# Deployment instructions:
See [CONFIGURATION.md](./CONFIGURATION.md) for configuration instructions
There are three ways to deploy mCaptcha:
1. Docker