From 668157c552d537d09bcea7c7124ec97334d57372 Mon Sep 17 00:00:00 2001 From: cookietime--yay Date: Mon, 4 Mar 2019 12:50:20 +0100 Subject: [PATCH] Remove hardcoded paths for logs and frontend host. Add log path option to sample config.toml file. --- config.py | 6 ++++++ config.toml.example | 3 +++ frontend.py | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index bc7baaf..02ef632 100755 --- a/config.py +++ b/config.py @@ -54,6 +54,12 @@ def load_env(): except KeyError: pass + try: + if os.environ['LOG_PATH'] != "": + configdict['log']['log_path'] = os.environ['LOG_PATH'] + except KeyError: + pass + return configdict diff --git a/config.toml.example b/config.toml.example index eb519db..35c6316 100644 --- a/config.toml.example +++ b/config.toml.example @@ -14,3 +14,6 @@ mbox_user = "root" [database] db_path = "/var/ticketfrei/db.sqlite" + +[log] +log_path = "/var/ticketfrei/error.log" diff --git a/frontend.py b/frontend.py index 38354a6..7d7a539 100755 --- a/frontend.py +++ b/frontend.py @@ -265,7 +265,7 @@ def login_mastodon(user): logger = logging.getLogger() -fh = logging.FileHandler('/var/log/ticketfrei/error.log') +fh = logging.FileHandler(config['log']['log_path']) fh.setLevel(logging.DEBUG) logger.addHandler(fh) @@ -273,6 +273,6 @@ application = bottle.default_app() bottle.install(SessionPlugin('/')) if __name__ == '__main__': - bottle.run(host="0.0.0.0", port=config["web"]["port"]) + bottle.run(host=config["web"]["host"], port=config["web"]["port"]) else: application.catchall = False