Skip to content

Commit 59b0485

Browse files
committed
Document the updated configuration requirements
1 parent ab3b202 commit 59b0485

2 files changed

Lines changed: 19 additions & 60 deletions

File tree

docs/configuration.md

Lines changed: 18 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,21 @@ Olli provides several configuration options to alter how the application behaves
1414

1515
# File Format
1616

17-
Olli uses TOML for it's configuration, below the headings such as `olli` correspond to the outer block and the keys inside to the inner block. For example, the `olli` configuration section has a key `interval_minutes`, which in code looks like:
18-
19-
```toml
20-
[olli]
21-
interval_minutes = 5
22-
```
17+
Olli uses a .env file or environment variables for it's configuration, see `.env.example` for an example `.env` file. This file must either exist in the project root directory, or environment variables must be made available to the container.
2318

2419
Configuration is validated on startup and if a key is missing or otherwise incorrectly formatted Olli will refuse to start with an error.
2520

26-
# File location
27-
28-
Olli searches several locations for a config file to simplify deployment.
29-
30-
An Olli config file can reside at:
31-
- `olli.toml` (in the current working directory)
32-
- `/config/olli.toml`
33-
- `/olli/config.toml`
34-
- `/etc/olli/config.toml`
35-
36-
The order above is the order that Olli searches for configuration files.
37-
3821
# Sections
3922

40-
## `olli`
23+
## `service`
4124

42-
`interval_minutes` (required): The interval that Olli should poll during, for example if this is set to 5 then Olli will search the logs for the past 5 minutes every 5 minutes and report.
25+
`service_interval_minutes` (required): The interval that Olli should poll during, for example if this is set to 5 then Olli will search the logs for the past 5 minutes every 5 minutes and report.
4326

4427
### Tokens
4528

46-
Olli takes in a list of tokens to scan for, and each token has a set of configuration options. In the configuration file a set of tokens looks like:
29+
Olli takes in a list of tokens to scan for, and each token is a JSON dictionary containing a set of configuration options. In the configuration file a set of tokens looks like:
4730
```toml
48-
[[olli.tokens]]
49-
token = "ERROR"
50-
color = "#ff5f5f"
51-
52-
[[olli.tokens]]
53-
token = "INFO"
54-
case_sensitive = true
31+
service_tokens=[{"token":"ERROR","color":"#ff5f5f"},{"token":"WARN","color":"#ffe24d"},{"token":"INFO"}]
5532
# When no color is provided it falls back to blurple.
5633
```
5734

@@ -61,44 +38,26 @@ Tokens also accept a `case_sensitive` key which defaults to `false`. If you want
6138

6239
## `loki`
6340

64-
`api_url`: The base URL of your Loki instance, for example `"http://localhost:3100/"`.
41+
`loki_api_url`: The base URL of your Loki instance, for example `http://localhost:3100/`.
6542

66-
`jobs`: A list of jobs to filter for logs in, only services in this list will be searched for tokens. An example might be `jobs = ["default/bot", "default/site"]`.
43+
`loki_jobs`: A list of jobs to filter for logs in, only services in this list will be searched for tokens. An example might be `loki_jobs=["default/bot","default/site"]`.
6744

68-
`max_logs`: This is passed on to Loki to define the maximum number of logs that should be returned, it defaults to 5,000 (raised from the 100 default of Loki).
45+
`loki_max_logs`: This is passed on to Loki to define the maximum number of logs that should be returned, it defaults to 5,000 (raised from the 100 default of Loki).
6946

7047
## `discord`
7148

72-
`webhook_url`: This should be a Discord webhook which Olli will POST to when a service has hit a token filter in the last interval. It is optional but if not specified **must be provided in the `WEBHOOK_URL` environment variable.**
49+
`discord_webhook_url` (required): This should be a Discord webhook which Olli will POST to when a service has hit a token filter in the last interval.
7350

7451
# Putting it together
7552

76-
All together, a configuration file for Olli might look somethinng along the lines of:
53+
All together, a configuration file for Olli might look something along the lines of:
7754

78-
```toml
79-
[olli]
80-
interval_minutes = 5
81-
82-
[loki]
83-
api_url = "http://localhost:3100/"
84-
jobs = [
85-
"default/bot"
86-
]
87-
88-
[discord]
89-
# The only Discord configuration option is webhook_url, which you can
90-
# either specify here or in an environment variable called WEBHOOK_URL
91-
# with the config file taking precedence.
92-
93-
[[olli.tokens]]
94-
token = "ERROR"
95-
color = "#ff5f5f"
96-
97-
[[olli.tokens]]
98-
token = "WARN"
99-
color = "#ffe24d"
100-
case_sensitive = true
101-
102-
[[olli.tokens]]
103-
token = "INFO"
55+
```
56+
loki_api_url=http://localhost:3100/
57+
loki_jobs=["default/bot"]
58+
59+
discord_webhook_url=some_discord_webhook
60+
61+
service_interval_minutes=5
62+
service_tokens=[{"token":"ERROR","color":"#ff5f5f"},{"token":"WARN","color":"#ffe24d"},{"token":"INFO"}]
10463
```

docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Once you have a container image you need to configure it by placing a config fil
2525

2626
An example Docker run might look like:
2727
```bash
28-
$ docker run -e "WEBHOOK_URL=abc" --mount type=bind,source=$(pwd)/config-example.toml,target=/olli/config.toml ghcr.io/python-discord/olli:latest
28+
$ docker run --env-file .env ghcr.io/python-discord/olli:latest
2929
```
3030

3131
## Kubernetes

0 commit comments

Comments
 (0)