diff --git a/README.md b/README.md index 9ef5830..66ecdec 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,8 @@ Be sure you've followed the Python virtual environment steps above and activated The docker entrypoint.sh will automatically copy config.ini.sample to config.ini if you want to edit config, make sure you add the config directory as a docker volume. +Environment Variables: FORTUNE_FILE, DB_FILE, CONFIG_FILE + ```sh docker run -it --name tc2bbsmesh -v tc2bbsmesh-config:/app/config/ -v tc2bbsmesh-data:/app/data/ --device=/dev/ttyACM0 tc2-bbs-mesh ``` diff --git a/command_handlers.py b/command_handlers.py index 9a96241..f6cb351 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -1,4 +1,5 @@ import logging +import os import random import time @@ -89,7 +90,7 @@ def handle_stats_command(sender_id, interface): def handle_fortune_command(sender_id, interface): try: - with open('fortunes.txt', 'r') as file: + with open(os.getenv('FORTUNE_FILE','data/fortunes.txt'), 'r') as file: fortunes = file.readlines() if not fortunes: send_message("No fortunes available.", sender_id, interface) @@ -389,4 +390,4 @@ def handle_channel_directory_steps(sender_id, message, step, state, interface): channel_name = state['channel_name'] add_channel(channel_name, channel_url) send_message(f"Your channel '{channel_name}' has been added to the directory.", sender_id, interface) - handle_channel_directory_command(sender_id, interface) \ No newline at end of file + handle_channel_directory_command(sender_id, interface) diff --git a/config.ini.sample b/config/config.ini.sample similarity index 100% rename from config.ini.sample rename to config/config.ini.sample diff --git a/fortunes.txt b/data/fortunes.txt similarity index 100% rename from fortunes.txt rename to data/fortunes.txt