forked from LBRYCommunity/lbry-sdk
config options api_host and api_port changed to just api
This commit is contained in:
parent
9ccb3fa2a3
commit
19b0d59159
3 changed files with 14 additions and 14 deletions
|
@ -370,19 +370,19 @@ class BaseConfig:
|
||||||
|
|
||||||
class CLIConfig(BaseConfig):
|
class CLIConfig(BaseConfig):
|
||||||
|
|
||||||
# Changing this value is not-advised as it could potentially
|
api = String('Host name and port for lbrynet daemon API.', 'localhost:5279')
|
||||||
# expose the lbrynet daemon to the outside world which would
|
|
||||||
# give an attacker access to your wallet and you could lose
|
|
||||||
# all of your credits.
|
|
||||||
api_host = String(
|
|
||||||
'Host name for lbrynet daemon API.', 'localhost',
|
|
||||||
previous_names=['API_INTERFACE']
|
|
||||||
)
|
|
||||||
api_port = Integer('Port for lbrynet daemon API.', 5279)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def api_connection_url(self) -> str:
|
def api_connection_url(self) -> str:
|
||||||
return f"http://{self.api_host}:{self.api_port}/lbryapi"
|
return f"http://{self.api}/lbryapi"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def api_host(self):
|
||||||
|
return self.api.split(':')[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def api_port(self):
|
||||||
|
return int(self.api.split(':')[1])
|
||||||
|
|
||||||
|
|
||||||
class Config(CLIConfig):
|
class Config(CLIConfig):
|
||||||
|
|
|
@ -472,8 +472,8 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
await self.setup()
|
await self.setup()
|
||||||
await self.analytics_manager.send_server_startup_success()
|
await self.analytics_manager.send_server_startup_success()
|
||||||
except OSError:
|
except OSError:
|
||||||
log.error('lbrynet API failed to bind TCP %s:%i for listening. Daemon is already running or this port is '
|
log.error('lbrynet API failed to bind TCP %s for listening. Daemon is already running or this port is '
|
||||||
'already in use by another application.', self.conf.api_host, self.conf.api_port)
|
'already in use by another application.', self.conf.api)
|
||||||
except defer.CancelledError:
|
except defer.CancelledError:
|
||||||
log.info("shutting down before finished starting")
|
log.info("shutting down before finished starting")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
|
|
|
@ -39,7 +39,7 @@ class CLIIntegrationTest(AsyncioTestCase):
|
||||||
conf = Config()
|
conf = Config()
|
||||||
conf.data_dir = '/tmp'
|
conf.data_dir = '/tmp'
|
||||||
conf.share_usage_data = False
|
conf.share_usage_data = False
|
||||||
conf.api_port = 5299
|
conf.api = 'localhost:5299'
|
||||||
conf.components_to_skip = skip
|
conf.components_to_skip = skip
|
||||||
Daemon.component_attributes = {}
|
Daemon.component_attributes = {}
|
||||||
self.daemon = Daemon(conf)
|
self.daemon = Daemon(conf)
|
||||||
|
@ -51,6 +51,6 @@ class CLIIntegrationTest(AsyncioTestCase):
|
||||||
def test_cli_status_command_with_auth(self):
|
def test_cli_status_command_with_auth(self):
|
||||||
actual_output = StringIO()
|
actual_output = StringIO()
|
||||||
with contextlib.redirect_stdout(actual_output):
|
with contextlib.redirect_stdout(actual_output):
|
||||||
cli.main(["--api-port", "5299", "status"])
|
cli.main(["--api", "localhost:5299", "status"])
|
||||||
actual_output = actual_output.getvalue()
|
actual_output = actual_output.getvalue()
|
||||||
self.assertIn("connection_status", actual_output)
|
self.assertIn("connection_status", actual_output)
|
||||||
|
|
Loading…
Reference in a new issue