diff options
-rwxr-xr-x | extra/stackbin.init | 1 | ||||
-rw-r--r-- | extra/stackbin.service | 1 | ||||
-rwxr-xr-x | stackbin.py | 6 |
3 files changed, 7 insertions, 1 deletions
diff --git a/extra/stackbin.init b/extra/stackbin.init index 057c793..34d915d 100755 --- a/extra/stackbin.init +++ b/extra/stackbin.init @@ -25,6 +25,7 @@ SCRIPTNAME=/etc/init.d/$NAME USER=stackbin WSGIBIN=uwsgi_python39 export STACKBIN_WSGI_INI=/etc/stackbin.wsgi.ini +export STACKBIN_CONF=/etc/stackbin.conf # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 diff --git a/extra/stackbin.service b/extra/stackbin.service index d2aad39..64da880 100644 --- a/extra/stackbin.service +++ b/extra/stackbin.service @@ -5,6 +5,7 @@ After=network.target syslog.target [Service] Environment=STACKBIN_WSGI_INI=/etc/stackbin.wsgi.ini +Environment=STACKBIN_CONF=/etc/stackbin.conf WorkingDirectory=/var/stackbin User=stackbin Group=stackbin diff --git a/stackbin.py b/stackbin.py index 1b08b43..f4059f0 100755 --- a/stackbin.py +++ b/stackbin.py @@ -9,6 +9,7 @@ from flask import (Flask, request, url_for, redirect, g, render_template, sessio from flask_sqlalchemy import SQLAlchemy from werkzeug.middleware.proxy_fix import ProxyFix from pytimeparse.timeparse import timeparse # python3-pytimeparse +import os # uwsgidecorators load will fail when using initdb.py but is also not necessary try: from uwsgidecorators import timer # python3-uwsgidecorators @@ -52,7 +53,10 @@ def get_unsigned(string, salt="blank"): return Signer(app.secret_key, salt=salt).unsign(str(string)).decode("utf-8") app = Flask(__name__) -app.config.from_pyfile('stackbin.conf') +try: + app.config.from_pyfile(os.environ['STACKBIN_CONF']) +except: + app.config.from_pyfile('stackbin.conf') db = SQLAlchemy(app) if "STATIC_FOLDER" in app.config: app.static_folder=app.config["STATIC_FOLDER"] |