1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 10:24:26 +01:00

Add proper debugging mode

For production, only listen on localhost, in Debug mode,
allow anything from 0.0.0.0

Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
Ralf Ramsauer 2018-09-05 18:23:39 +00:00
parent da08f768a1
commit 31afb91f8d

View File

@ -80,6 +80,10 @@ wave_unlock_button = webapp.config.get('WAVE_UNLOCK_BUTTON')
wave_zonk = webapp.config.get('WAVE_ZONK') wave_zonk = webapp.config.get('WAVE_ZONK')
sounds = webapp.config.get('SOUNDS') sounds = webapp.config.get('SOUNDS')
host = 'localhost'
if webapp.config.get('DEBUG'):
host = '0.0.0.0'
# copied from sudo # copied from sudo
eperm_insults = { eperm_insults = {
'Wrong! You cheating scum!', 'Wrong! You cheating scum!',
@ -407,8 +411,6 @@ def on_connect():
@webapp.route('/display') @webapp.route('/display')
def display(): def display():
if request.remote_addr != '127.0.0.1':
abort(403)
return render_template('display.html') return render_template('display.html')
@ -492,6 +494,6 @@ if __name__ == '__main__':
logic = Logic() logic = Logic()
socketio.run(webapp, host='0.0.0.0', port=8080) socketio.run(webapp, host=host, port=8080)
sys.exit(0) sys.exit(0)