mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
Follow comment: reimplement with args default value
This commit is contained in:
parent
06eb0858eb
commit
f80d13079b
3 changed files with 3 additions and 7 deletions
|
@ -889,7 +889,7 @@ def parse_args(argv):
|
||||||
"--port",
|
"--port",
|
||||||
help="The HTTP port to open connections on. Defaults to 6052.",
|
help="The HTTP port to open connections on. Defaults to 6052.",
|
||||||
type=int,
|
type=int,
|
||||||
default=0,
|
default=os.environ.get("ESPHOME_DASHBOARD_PORT", 6052),
|
||||||
)
|
)
|
||||||
parser_dashboard.add_argument(
|
parser_dashboard.add_argument(
|
||||||
"--address",
|
"--address",
|
||||||
|
|
|
@ -137,10 +137,9 @@ async def async_start(args) -> None:
|
||||||
await dashboard.async_setup()
|
await dashboard.async_setup()
|
||||||
sock: socket.socket | None = args.socket
|
sock: socket.socket | None = args.socket
|
||||||
address: str | None = args.address
|
address: str | None = args.address
|
||||||
|
port: int | None = args.port
|
||||||
|
|
||||||
start_web_server(
|
start_web_server(make_app(args.verbose), sock, address, port, settings.config_dir)
|
||||||
make_app(args.verbose), sock, address, settings.port, settings.config_dir
|
|
||||||
)
|
|
||||||
|
|
||||||
if args.open_ui:
|
if args.open_ui:
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
|
@ -19,7 +19,6 @@ class DashboardSettings:
|
||||||
"password_hash",
|
"password_hash",
|
||||||
"username",
|
"username",
|
||||||
"using_password",
|
"using_password",
|
||||||
"port",
|
|
||||||
"on_ha_addon",
|
"on_ha_addon",
|
||||||
"cookie_secret",
|
"cookie_secret",
|
||||||
"absolute_config_dir",
|
"absolute_config_dir",
|
||||||
|
@ -32,7 +31,6 @@ class DashboardSettings:
|
||||||
self.password_hash: str = ""
|
self.password_hash: str = ""
|
||||||
self.username: str = ""
|
self.username: str = ""
|
||||||
self.using_password: bool = False
|
self.using_password: bool = False
|
||||||
self.port: int = 6052
|
|
||||||
self.on_ha_addon: bool = False
|
self.on_ha_addon: bool = False
|
||||||
self.cookie_secret: str | None = None
|
self.cookie_secret: str | None = None
|
||||||
self.absolute_config_dir: Path | None = None
|
self.absolute_config_dir: Path | None = None
|
||||||
|
@ -47,7 +45,6 @@ class DashboardSettings:
|
||||||
self.using_password = bool(password)
|
self.using_password = bool(password)
|
||||||
if self.using_password:
|
if self.using_password:
|
||||||
self.password_hash = password_hash(password)
|
self.password_hash = password_hash(password)
|
||||||
self.port = args.port or os.getenv("ESPHOME_DASHBOARD_PORT") or 6052
|
|
||||||
self.config_dir = args.configuration
|
self.config_dir = args.configuration
|
||||||
self.absolute_config_dir = Path(self.config_dir).resolve()
|
self.absolute_config_dir = Path(self.config_dir).resolve()
|
||||||
self.verbose = args.verbose
|
self.verbose = args.verbose
|
||||||
|
|
Loading…
Reference in a new issue