mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 02:14:26 +01:00
doorlockd.py: Add config parameter for hooks
Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
parent
6e2655e6e5
commit
4d1682d1bd
@ -1,5 +1,6 @@
|
||||
DEBUG = True
|
||||
SIMULATE = True
|
||||
RUN_HOOKS = True
|
||||
SECRET_KEY = 'foobar'
|
||||
|
||||
BOOTSTRAP_SERVE_LOCAL = True
|
||||
|
@ -60,6 +60,7 @@ socketio = SocketIO(webapp, async_mode=None)
|
||||
Bootstrap(webapp)
|
||||
serial_port = webapp.config.get('SERIAL_PORT')
|
||||
simulate = webapp.config.get('SIMULATE')
|
||||
run_hooks = webapp.config.get('RUN_HOOKS')
|
||||
|
||||
# copied from sudo
|
||||
eperm_insults = {
|
||||
@ -89,8 +90,8 @@ def choose_insult():
|
||||
|
||||
|
||||
def start_hook(script):
|
||||
if simulate:
|
||||
log.info('Simulation mode: not starting %s' % script)
|
||||
if not run_hooks:
|
||||
log.info('Hooks disabled: not starting %s' % script)
|
||||
return
|
||||
log.info('Starting hook %s' % script)
|
||||
Popen(['nohup', script])
|
||||
|
Loading…
Reference in New Issue
Block a user