add -b/--bind

This commit is contained in:
Jude Nelson
2017-03-16 18:03:25 -04:00
parent 9428761a94
commit b8ff276d72
2 changed files with 14 additions and 2 deletions

View File

@@ -250,6 +250,14 @@ def run_cli(argv=None, config_path=CONFIG_PATH):
'env': 'BLOCKSTACK_API_SESSION',
'help': 'API session token to use',
},
'api_bind': {
'short': '-b',
'long': '--bind',
'has_arg': True,
're-exec': False,
'env': 'BLOCKSTACK_API_BIND',
'help': 'Address or hostname to bind the API server',
},
'dry_run': {
'short': '-n',
'long': '--dry_run',

View File

@@ -3840,8 +3840,12 @@ def make_local_api_server(api_pass, portnum, wallet_keys, api_bind=None, config_
"""
conf = blockstack_config.get_config(config_path)
assert conf
api_bind = conf.get('api_endpoint_bind', 'localhost') if api_bind is None else api_bind
# arg --> envar --> config
if api_bind is None:
api_bind = os.environ.get("BLOCKSTACK_API_BIND", None)
if api_bind is None:
api_bind = conf.get('api_endpoint_bind', 'localhost') if api_bind is None else api_bind
srv = BlockstackAPIEndpoint(api_pass, wallet_keys, host=api_bind, port=portnum, config_path=config_path)
return srv