diff --git a/app.py b/app.py index 2eda104..8c3fff8 100644 --- a/app.py +++ b/app.py @@ -3,12 +3,13 @@ from pygrocy.data_models.generic import EntityType from flask import Flask, render_template, request, redirect from datetime import datetime from werkzeug.middleware.proxy_fix import ProxyFix +import os from pprint import pprint -#Global variables +#Default global variables DEFAULT_AMOUNT = 1 -CASHBOX_USERID = 3 +CASHBOX_USERID = 1 error_messages = { 'item_not_found': 'Tenhle produkt nemůžeme najít ve skladu. Zkus to prosím znovu a pokud to nepůjde, řekni někomu z Trhliny.', @@ -16,9 +17,13 @@ error_messages = { 'user_not_found': 'Tenhle účet neexistuje nebo nemá povolený kredit. Můžeš věc naskenovat znovu a hodit prachy do kasičky', } +GROCY_URL = os.getenv('GROCY_URL') +GROCY_API_KEY = os.getenv('GROCY_API_KEY') +GROCY_PORT = os.getenv('GROCY_PORT') +CASHBOX_USERID = os.getenv('CASHBOX_USER_ID') -g = Grocy("http://localhost", "BZzLkorATL66hSbKwIERoesALcIqNUPW91zONNNTHP0r9N6vk2", port=8080) +g = Grocy(GROCY_URL, GROCY_API_KEY, port=GROCY_PORT) # Write money movement into the ledger (transaction log in Grocy). diff --git a/sample-config.env b/sample-config.env new file mode 100644 index 0000000..59aa38e --- /dev/null +++ b/sample-config.env @@ -0,0 +1,4 @@ +GROCY_URL=https://en.demo.grocy.info +GROCY_API_KEY=xxxxx +GROCY_PORT=443 +CASHBOX_USER_ID=2 \ No newline at end of file