mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add an argument to start api without WebSocket support
This commit is contained in:
parent
60b555ad76
commit
925cf4b070
1 changed files with 6 additions and 1 deletions
|
@ -36,15 +36,20 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# Additional arguments
|
# Additional arguments
|
||||||
cache = True
|
cache = True
|
||||||
|
websocket = True
|
||||||
if '--no-cache' in sys.argv:
|
if '--no-cache' in sys.argv:
|
||||||
cache = False
|
cache = False
|
||||||
sys.argv.remove('--no-cache')
|
sys.argv.remove('--no-cache')
|
||||||
|
if '--no-websocket' in sys.argv:
|
||||||
|
websocket = False
|
||||||
|
sys.argv.remove('--no-websocket')
|
||||||
# TODO: Add log argument
|
# TODO: Add log argument
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Run the server
|
# Run the server
|
||||||
api(['yunohost'], port=6787,
|
api(['yunohost'], port=6787,
|
||||||
routes={('GET', '/installed'): is_installed}, use_cache=cache)
|
routes={('GET', '/installed'): is_installed},
|
||||||
|
use_cache=cache, use_websocket=websocket)
|
||||||
except MoulinetteError as e:
|
except MoulinetteError as e:
|
||||||
from moulinette.interfaces.cli import colorize
|
from moulinette.interfaces.cli import colorize
|
||||||
print('%s %s' % (colorize(m18n.g('error'), 'red'), e.strerror))
|
print('%s %s' % (colorize(m18n.g('error'), 'red'), e.strerror))
|
||||||
|
|
Loading…
Add table
Reference in a new issue