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

refactoring
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:
pass
try:
if os.environ['LOG_PATH'] != "":
configdict['log']['log_path'] = os.environ['LOG_PATH']
except KeyError:
pass
return configdict

View File

@ -14,3 +14,6 @@ mbox_user = "root"
[database]
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()
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