better note about configs and added support for config comments

This commit is contained in:
shockrah 2020-12-15 14:22:29 -08:00
parent 2efc163f8e
commit 97028f8bd2
2 changed files with 19 additions and 6 deletions

View File

@ -46,6 +46,8 @@ def read_config(path: str) -> dict:
with open(path, 'r') as cfg:
# Line format key=value
for line in cfg:
if line.startswith('#'):
continue
line = line.strip()
key = line[:line.find('=')]
value = line[line.find('=')+1:]

View File

@ -7,15 +7,26 @@ This is basically another chronjob script that will execute every few minutes or
## Options and what they do
* time-out [VALUE] : sets an expiration timer for messages (on the order of days)
-h --help : Shows a help message then exits
Example : `--time-out 30` messages older than 30 days will be deletede
-m MAX_AGE_DAYS --max-age-days MAX_AGE_DAYS : Sets how old messages are allowed to be to avoid deletion(in days)
* message-limit [VALUE] : sets the max number of messages allowed in each channel
Example `-m 7` deletes messages older than 7 days.
Example : `--message-limit 1000` after 1000 messages the oldest message will be removed to keep the amount of messages to around 1000.
-f FILE_ENV --file-env FILE_ENV : **Required** path to config file. See example below.
NOTE : this creates a new process if --no-poll is specified
```
# Lines starting with '#' are ignored as comments
# No spaces between the keyname and '=' sign and value on the right
# '"' marks are also not required
# Keys the script doesn't care about are ignored
DATABASE_URL=mysql://user-account-to-use-the-db:supersecretpassword123@db.host.provider.io:3306/dbname-example
* --no-poll : Opt out of polling and listen for changes in the database
# Below are all the required keys for the script to work, the rest are ignored
DATABASE_NAME=dbname-example
DATABASE_PASS=supersecretpassword123
DATABASE_USER=user-account-to-use-the-db
DATABASE_HOST=db.host.provider.io
DATABASE_PORT=3306
```