From 030f2cf270a486f317fcb4b9e168ccc4cfcfb640 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 15 Feb 2022 10:34:40 -0500 Subject: load stackbin_conf from env --- stackbin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'stackbin.py') 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"] -- cgit