forked from platypush/platypush
More robust support for Redis configuration in web socket server
This commit is contained in:
parent
b3d82bf43e
commit
4ebdda80f9
4 changed files with 7 additions and 6 deletions
|
@ -4,3 +4,4 @@ requests
|
||||||
flask
|
flask
|
||||||
redis
|
redis
|
||||||
python-dateutil
|
python-dateutil
|
||||||
|
websockets
|
||||||
|
|
|
@ -116,9 +116,12 @@ class HttpBackend(Backend):
|
||||||
def _get_redis(self):
|
def _get_redis(self):
|
||||||
redis_backend = get_backend('redis')
|
redis_backend = get_backend('redis')
|
||||||
if not redis_backend:
|
if not redis_backend:
|
||||||
raise RuntimeError('Redis backend not configured')
|
self.logger.warning('Redis backend not configured - some ' +
|
||||||
|
'web server features may not be working properly')
|
||||||
|
redis_args = {}
|
||||||
|
else:
|
||||||
|
redis_args = redis_backend.redis_args
|
||||||
|
|
||||||
redis_args = get_backend('redis').redis_args
|
|
||||||
redis = Redis(**redis_args)
|
redis = Redis(**redis_args)
|
||||||
return redis
|
return redis
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ def get_backend(name):
|
||||||
""" Returns the backend instance identified by name if it exists """
|
""" Returns the backend instance identified by name if it exists """
|
||||||
|
|
||||||
global backends
|
global backends
|
||||||
return backends[name]
|
return backends.get('name')
|
||||||
|
|
||||||
|
|
||||||
def get_plugin(plugin_name, reload=False):
|
def get_plugin(plugin_name, reload=False):
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
backend.redis:
|
|
||||||
disabled: False
|
|
||||||
|
|
||||||
backend.http:
|
backend.http:
|
||||||
port: 8123
|
port: 8123
|
||||||
disable_websocket: True
|
disable_websocket: True
|
||||||
|
|
Loading…
Reference in a new issue