1
0

config can be changed on the fly, moved to volume

This commit is contained in:
Akbar Rahman 2018-09-16 12:44:48 +01:00
parent a3ddc41118
commit f671a3b198
Signed by: alvierahman90
GPG Key ID: 20609519444A1269
3 changed files with 5 additions and 6 deletions

View File

@ -3,5 +3,4 @@ WORKDIR /usr/src/app
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
COPY src . COPY src .
COPY config.json ./
CMD [ "python", "bot.py"] CMD [ "python", "bot.py"]

View File

@ -6,7 +6,7 @@ A bot to hold your todo.txt tasks
### install ### install
1. `git clone` the project or download it 1. `git clone` the project or download it
2. Create bot with [@botfather](https://t.me/botfather) 2. Create bot with [@botfather](https://t.me/botfather)
3. create `config.json` in root directory of project: 3. create `YOUR_CONFIG_DIRECTORY/config.json`:
```json ```json
{ {
"token": "285908433:AAHyxGFXtG37Ox_AvPPYB_J73iNpT7rk1JM" "token": "285908433:AAHyxGFXtG37Ox_AvPPYB_J73iNpT7rk1JM"
@ -14,8 +14,8 @@ A bot to hold your todo.txt tasks
} }
``` ```
4. run `cp docker-compose.example docker-compose.yml` 4. run `cp docker-compose.example docker-compose.yml`
5. run `mkdir YOUR_TASKS_DIRECTORY` 5. run `mkdir YOUR_CONFIG_DIRECTORY`
6. run `echo {} > YOUR_TASKS_DIRECTORY/tasks.json` 6. run `echo {} > YOUR_CONFIG_DIRECTORY/tasks.json`
7. edit `docker-compose.yml` bot.volumes to match your directory with your tasks 7. edit `docker-compose.yml` bot.volumes to match your directory with your tasks
8. run `docker-compose up` 8. run `docker-compose up`

View File

@ -20,9 +20,9 @@ VERSION = "v1.1"
PROPERTY_LAST_COMMAND = "last_command" PROPERTY_LAST_COMMAND = "last_command"
PROPERTY_LAST_ARGUMENTS = "last_arguments" PROPERTY_LAST_ARGUMENTS = "last_arguments"
CONFIG_FILE = 'config.json' CONFIG_FILE = '/config/config.json'
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
TASKS_FILE="/tasks/tasks.json" TASKS_FILE="/config/tasks.json"
with open(CONFIG_FILE) as file: with open(CONFIG_FILE) as file: