diff --git a/.gitignore b/.gitignore
index c24869a..774ad04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ key
# config
*.conf
+*.cfg
pricing.yaml
# Byte-compiled / optimized / DLL files
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
new file mode 100644
index 0000000..d7845ae
--- /dev/null
+++ b/DEVELOPMENT.md
@@ -0,0 +1,63 @@
+# Development
+
+## BTCPay Server
+
+You can pair with your existing production BTCPay Server, or [set one up locally](https://github.com/btcpayserver/btcpayserver-doc/blob/master/LocalDevelopment.md).
+
+## Run development server
+
+Clone the repository.
+
+Install Python dependencies:
+
+```sh
+pip3 install flask flask_admin flask_apscheduler flask_login flask_principal flask_fileupload flask_bootstrap flask_migrate flask_ezmail
+pip3 install gunicorn apscheduler sqlalchemy
+pip3 install markdown python-slugify jwt psutil
+pip3 install btcpay
+pip3 install squareconnect
+```
+
+Configure database and settings path:
+
+```sh
+export ISSO_CONFIG_PATH=$PWD/isso.cfg
+export COMMENTS_DB_PATH=$PWD/comments.db
+```
+
+Create or upgrade the database:
+
+```sh
+flask db upgrade
+```
+
+Start the server:
+
+```sh
+docker_boot.py & gunicorn patron:app
+```
+## Run tests
+
+Install Python dependencies:
+
+```sh
+pip3 install pytest
+```
+
+Configure database path:
+
+```sh
+export COMMENTS_DB_PATH_TEST=$PWD/comments-test.db
+```
+
+Create or upgrade the test database:
+
+
+```sh
+flask db upgrade
+```
+
+Run tests:
+``sh
+python3 -m pytest
+```
diff --git a/README.md b/README.md
index 7177f87..d4adc06 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ That's it! You would replace `example.com` with the domain where you wish to hos
You only ever need to do that setup once, as from then on LibrePatron will update alongside BTCPay.
-If you didn't use the LunaNode one-click install, the same instructions above apply so long as you're using the dockerized version of BTCPay.
+If you didn't use the LunaNode one-click install, the same instructions above apply so long as you're using the dockerized version of BTCPay.
If you wish to install separately from BTCPay for whatever reason, see the alternate instructions in the 'alternate_install' directory.
@@ -66,7 +66,7 @@ IMPORTANT: Before advertising your site, see the section on post-install setup b
Post-Install Setup
-The first visitor to the site will be prompted to register as administrator. The administrator is the user that posts updates, gets paid, etc. The administrator is the content creator.
+The first visitor to the site will be prompted to register as administrator. The administrator is the user that posts updates, gets paid, etc. The administrator is the content creator.
Heading to the admin panel should be your first step after registering as the admin, as the site will not function properly until email and BTCPay Server settings are filled in. Square settings for accepting fiat are optional, as are the settings for Google Analytics and user comments. BTCPay pairing and email setup are mandatory, and your site will malfunction without them.
@@ -75,3 +75,7 @@ You'll need SMTP server info for the email section. Gmail, Yahoo, etc are not go
Your users will get a 5 hour subscription as soon as they pay their BTCPay invoice. That is bumped to 30 days as soon as BTCPay recognizes the payment as "confirmed". BTCPay settings determine how many confirmations are required to make a payment "confirmed."
If you decide to allow fiat payments, after setting up square, it is suggested that you run a [test charge by follwing these instructions](https://github.com/JeffVandrewJr/patron/blob/master/test-charge.md).
+
+Development
+
+See [DEVELOPMENT.md](DEVELOPMENT.md) for instructions on how to run a local development copy and how to contribute code.
diff --git a/app/admin_utils/utils.py b/app/admin_utils/utils.py
index 14199e2..20f0d78 100644
--- a/app/admin_utils/utils.py
+++ b/app/admin_utils/utils.py
@@ -7,12 +7,12 @@ def isso_config():
# isso requires a config file
# this function writes a config file in isso format
# file is saved in a Docker volume shared between lp and isso
- file = '/var/lib/config/isso.cfg'
+ file = current_app.config['ISSO_CONFIG_PATH']
isso_pass = ThirdPartyServices.query.filter_by(
name='isso').first().code
isso_config = ConfigParser()
isso_config['general'] = {}
- isso_config['general']['dbpath'] = '/var/lib/db/comments.db'
+ isso_config['general']['dbpath'] = current_app.config['COMMENTS_DB_PATH']
isso_config['general']['host'] = current_app.config['BLOGGING_SITEURL']
isso_config['admin'] = {}
isso_config['admin']['enabled'] = 'true'
diff --git a/config.py b/config.py
index 7881978..c8c08aa 100644
--- a/config.py
+++ b/config.py
@@ -21,6 +21,7 @@ class Config(object):
BLOGGING_ALLOW_FILE_UPLOAD = True
BLOGGING_ESCAPE_MARKDOWN = False
ISSO_CONFIG_PATH = os.environ.get('ISSO_CONFIG_PATH') or '/var/lib/config/isso.cfg'
+ COMMENTS_DB_PATH = os.environ.get('COMMENTS_DB_PATH') or '/var/lib/db/comments.db'
COMMENTS = False
COMMENTS_SUBURI = os.environ.get('COMMENTS_SUBURI') is not None
if COMMENTS_SUBURI:
diff --git a/tests/tconfig.py b/tests/tconfig.py
index 05bf017..16ac01b 100644
--- a/tests/tconfig.py
+++ b/tests/tconfig.py
@@ -21,6 +21,7 @@ class Config(object):
BLOGGING_ALLOW_FILE_UPLOAD = True
BLOGGING_ESCAPE_MARKDOWN = False
ISSO_CONFIG_PATH = f'/tmp/{os.urandom(16)}'
+ COMMENTS_DB_PATH = os.environ.get('COMMENTS_DB_PATH_TEST') or '/var/lib/db/comments.db'
PREFERRED_URL_SCHEME = 'https'
SCHEDULER_BASE = datetime.now() + timedelta(minutes=1)
SCHEDULER_HOUR = SCHEDULER_BASE.hour