Merge pull request #455 from lbryio/better-defaults
Change default behavior with daemon cmdline args
This commit is contained in:
commit
ac8a63bc33
2 changed files with 4 additions and 26 deletions
|
@ -44,17 +44,12 @@ def start():
|
||||||
"--branch",
|
"--branch",
|
||||||
help='Branch of lbry-web-ui repo to use, defaults to {}'.format(conf.settings['ui_branch']),
|
help='Branch of lbry-web-ui repo to use, defaults to {}'.format(conf.settings['ui_branch']),
|
||||||
default=conf.settings['ui_branch'])
|
default=conf.settings['ui_branch'])
|
||||||
parser.add_argument('--no-launch', dest='launchui', action="store_false")
|
parser.add_argument('--launch-ui', dest='launchui', action="store_true")
|
||||||
parser.add_argument("--http-auth", dest="useauth", action="store_true",
|
parser.add_argument("--http-auth", dest="useauth", action="store_true",
|
||||||
default=conf.settings['use_auth_http'])
|
default=conf.settings['use_auth_http'])
|
||||||
parser.add_argument(
|
|
||||||
'--log-to-console', dest='logtoconsole', action='store_true',
|
|
||||||
help=('Set to enable console logging. Set the --verbose flag '
|
|
||||||
' to enable more detailed console logging'))
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--quiet', dest='quiet', action="store_true",
|
'--quiet', dest='quiet', action="store_true",
|
||||||
help=('If log-to-console is not set, setting this disables all console output. '
|
help='Disable all console output.')
|
||||||
'If log-to-console is set, this argument is ignored'))
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--verbose', nargs="*",
|
'--verbose', nargs="*",
|
||||||
help=('Enable debug output. Optionally specify loggers for which debug output '
|
help=('Enable debug output. Optionally specify loggers for which debug output '
|
||||||
|
@ -64,42 +59,25 @@ def start():
|
||||||
update_settings_from_args(args)
|
update_settings_from_args(args)
|
||||||
|
|
||||||
lbrynet_log = conf.settings.get_log_filename()
|
lbrynet_log = conf.settings.get_log_filename()
|
||||||
log_support.configure_logging(lbrynet_log, args.logtoconsole, args.verbose)
|
log_support.configure_logging(lbrynet_log, not args.quiet, args.verbose)
|
||||||
log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
|
log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
log.debug('Checking for an existing lbrynet daemon instance')
|
log.debug('Checking for an existing lbrynet daemon instance')
|
||||||
JSONRPCProxy.from_url(conf.settings.get_api_connection_string()).is_running()
|
JSONRPCProxy.from_url(conf.settings.get_api_connection_string()).is_running()
|
||||||
log.info("lbrynet-daemon is already running")
|
log.info("lbrynet-daemon is already running")
|
||||||
if not args.logtoconsole:
|
|
||||||
print "lbrynet-daemon is already running"
|
|
||||||
return
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
log.debug('No lbrynet instance found, continuing to start')
|
log.debug('No lbrynet instance found, continuing to start')
|
||||||
pass
|
|
||||||
|
|
||||||
log.info("Starting lbrynet-daemon from command line")
|
log.info("Starting lbrynet-daemon from command line")
|
||||||
|
|
||||||
if not args.logtoconsole and not args.quiet:
|
|
||||||
print "Starting lbrynet-daemon from command line"
|
|
||||||
print "To view activity, view the log file here: " + lbrynet_log
|
|
||||||
print "Web UI is available at http://%s:%i" % (
|
|
||||||
conf.settings['api_host'], conf.settings['api_port'])
|
|
||||||
print "JSONRPC API is available at " + conf.settings.get_api_connection_string()
|
|
||||||
print "To quit press ctrl-c or call 'stop' via the API"
|
|
||||||
|
|
||||||
if test_internet_connection():
|
if test_internet_connection():
|
||||||
analytics_manager = analytics.Manager.new_instance()
|
analytics_manager = analytics.Manager.new_instance()
|
||||||
start_server_and_listen(args.launchui, args.useauth, analytics_manager)
|
start_server_and_listen(args.launchui, args.useauth, analytics_manager)
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
||||||
if not args.logtoconsole and not args.quiet:
|
|
||||||
print "\nClosing lbrynet-daemon"
|
|
||||||
else:
|
else:
|
||||||
log.info("Not connected to internet, unable to start")
|
log.info("Not connected to internet, unable to start")
|
||||||
if not args.logtoconsole:
|
|
||||||
print "Not connected to internet, unable to start"
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def update_settings_from_args(args):
|
def update_settings_from_args(args):
|
||||||
|
|
|
@ -28,7 +28,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
|
||||||
if [ -z "$(pgrep lbrynet-daemon)" ]; then
|
if [ -z "$(pgrep lbrynet-daemon)" ]; then
|
||||||
echo "running lbrynet-daemon"
|
echo "running lbrynet-daemon"
|
||||||
$DIR/lbrynet-daemon --no-launch &
|
$DIR/lbrynet-daemon &
|
||||||
sleep 3 # let the daemon load before connecting
|
sleep 3 # let the daemon load before connecting
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue