Remove hardcoded paths for logs and frontend host. Add log path option to sample config.toml file.

This commit is contained in:
cookietime--yay 2019-03-04 12:50:20 +01:00
parent 39cf3bd070
commit 668157c552
3 changed files with 11 additions and 2 deletions

View file

@ -54,6 +54,12 @@ def load_env():
except KeyError: except KeyError:
pass pass
try:
if os.environ['LOG_PATH'] != "":
configdict['log']['log_path'] = os.environ['LOG_PATH']
except KeyError:
pass
return configdict return configdict

View file

@ -14,3 +14,6 @@ mbox_user = "root"
[database] [database]
db_path = "/var/ticketfrei/db.sqlite" db_path = "/var/ticketfrei/db.sqlite"
[log]
log_path = "/var/ticketfrei/error.log"

View file

@ -265,7 +265,7 @@ def login_mastodon(user):
logger = logging.getLogger() logger = logging.getLogger()
fh = logging.FileHandler('/var/log/ticketfrei/error.log') fh = logging.FileHandler(config['log']['log_path'])
fh.setLevel(logging.DEBUG) fh.setLevel(logging.DEBUG)
logger.addHandler(fh) logger.addHandler(fh)
@ -273,6 +273,6 @@ application = bottle.default_app()
bottle.install(SessionPlugin('/')) bottle.install(SessionPlugin('/'))
if __name__ == '__main__': 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: else:
application.catchall = False application.catchall = False