Allow specifying the dashboard bind address (#2787)

This commit is contained in:
Jesse Hills 2021-11-25 07:59:32 +13:00 committed by GitHub
parent 15cd602e8b
commit 7e8012c1a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -637,6 +637,12 @@ def parse_args(argv):
type=int,
default=6052,
)
parser_dashboard.add_argument(
"--address",
help="The address to bind to.",
type=str,
default="0.0.0.0",
)
parser_dashboard.add_argument(
"--username",
help="The optional username to require for authentication.",

View File

@ -970,16 +970,17 @@ def start_web_server(args):
server.add_socket(socket)
else:
_LOGGER.info(
"Starting dashboard web server on http://0.0.0.0:%s and configuration dir %s...",
"Starting dashboard web server on http://%s:%s and configuration dir %s...",
args.address,
args.port,
settings.config_dir,
)
app.listen(args.port)
app.listen(args.port, args.address)
if args.open_ui:
import webbrowser
webbrowser.open(f"localhost:{args.port}")
webbrowser.open(f"http://{args.address}:{args.port}")
if settings.status_use_ping:
status_thread = PingStatusThread()