remove rpc_host
This commit is contained in:
parent
5fc32f4ff2
commit
0cd23d0901
2 changed files with 4 additions and 9 deletions
|
@ -30,7 +30,7 @@ class Env:
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, db_dir=None, daemon_url=None, host=None, rpc_host=None, elastic_host=None,
|
def __init__(self, db_dir=None, daemon_url=None, host=None, elastic_host=None,
|
||||||
elastic_port=None, loop_policy=None, max_query_workers=None,
|
elastic_port=None, loop_policy=None, max_query_workers=None,
|
||||||
chain=None, es_index_prefix=None, cache_MB=None, reorg_limit=None, tcp_port=None,
|
chain=None, es_index_prefix=None, cache_MB=None, reorg_limit=None, tcp_port=None,
|
||||||
udp_port=None, ssl_port=None, ssl_certfile=None, ssl_keyfile=None,
|
udp_port=None, ssl_port=None, ssl_certfile=None, ssl_keyfile=None,
|
||||||
|
@ -46,7 +46,6 @@ class Env:
|
||||||
self.db_max_open_files = db_max_open_files
|
self.db_max_open_files = db_max_open_files
|
||||||
|
|
||||||
self.host = host if host is not None else self.default('HOST', 'localhost')
|
self.host = host if host is not None else self.default('HOST', 'localhost')
|
||||||
self.rpc_host = rpc_host if rpc_host is not None else self.default('RPC_HOST', 'localhost')
|
|
||||||
self.elastic_host = elastic_host if elastic_host is not None else self.default('ELASTIC_HOST', 'localhost')
|
self.elastic_host = elastic_host if elastic_host is not None else self.default('ELASTIC_HOST', 'localhost')
|
||||||
self.elastic_port = elastic_port if elastic_port is not None else self.integer('ELASTIC_PORT', 9200)
|
self.elastic_port = elastic_port if elastic_port is not None else self.integer('ELASTIC_PORT', 9200)
|
||||||
self.elastic_notifier_port = elastic_notifier_port if elastic_notifier_port is not None else self.integer('ELASTIC_NOTIFIER_PORT', 19080)
|
self.elastic_notifier_port = elastic_notifier_port if elastic_notifier_port is not None else self.integer('ELASTIC_NOTIFIER_PORT', 19080)
|
||||||
|
@ -181,7 +180,7 @@ class Env:
|
||||||
return loop_policy
|
return loop_policy
|
||||||
raise cls.Error(f'unknown event loop policy "{policy_name}"')
|
raise cls.Error(f'unknown event loop policy "{policy_name}"')
|
||||||
|
|
||||||
def cs_host(self, *, for_rpc):
|
def cs_host(self):
|
||||||
"""Returns the 'host' argument to pass to asyncio's create_server
|
"""Returns the 'host' argument to pass to asyncio's create_server
|
||||||
call. The result can be a single host name string, a list of
|
call. The result can be a single host name string, a list of
|
||||||
host name strings, or an empty string to bind to all interfaces.
|
host name strings, or an empty string to bind to all interfaces.
|
||||||
|
@ -189,14 +188,10 @@ class Env:
|
||||||
If rpc is True the host to use for the RPC server is returned.
|
If rpc is True the host to use for the RPC server is returned.
|
||||||
Otherwise the host to use for SSL/TCP servers is returned.
|
Otherwise the host to use for SSL/TCP servers is returned.
|
||||||
"""
|
"""
|
||||||
host = self.rpc_host if for_rpc else self.host
|
host = self.host
|
||||||
result = [part.strip() for part in host.split(',')]
|
result = [part.strip() for part in host.split(',')]
|
||||||
if len(result) == 1:
|
if len(result) == 1:
|
||||||
result = result[0]
|
result = result[0]
|
||||||
# An empty result indicates all interfaces, which we do not
|
|
||||||
# permitted for an RPC server.
|
|
||||||
if for_rpc and not result:
|
|
||||||
result = 'localhost'
|
|
||||||
if result == 'localhost':
|
if result == 'localhost':
|
||||||
# 'localhost' resolves to ::1 (ipv6) on many systems, which fails on default setup of
|
# 'localhost' resolves to ::1 (ipv6) on many systems, which fails on default setup of
|
||||||
# docker, using 127.0.0.1 instead forces ipv4
|
# docker, using 127.0.0.1 instead forces ipv4
|
||||||
|
|
|
@ -227,7 +227,7 @@ class SessionManager:
|
||||||
port was given in the environment.
|
port was given in the environment.
|
||||||
"""
|
"""
|
||||||
env = self.env
|
env = self.env
|
||||||
host = env.cs_host(for_rpc=False)
|
host = env.cs_host()
|
||||||
if env.tcp_port is not None:
|
if env.tcp_port is not None:
|
||||||
await self._start_server('TCP', host, env.tcp_port)
|
await self._start_server('TCP', host, env.tcp_port)
|
||||||
if env.ssl_port is not None:
|
if env.ssl_port is not None:
|
||||||
|
|
Loading…
Reference in a new issue