mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Streamer mode (#5119)
This commit is contained in:
parent
76c0d0912f
commit
89c5298bb9
2 changed files with 18 additions and 5 deletions
|
@ -365,10 +365,16 @@ def command_wizard(args):
|
|||
|
||||
|
||||
def command_config(args, config):
|
||||
_LOGGER.info("Configuration is valid!")
|
||||
if not CORE.verbose:
|
||||
config = strip_default_ids(config)
|
||||
safe_print(yaml_util.dump(config, args.show_secrets))
|
||||
output = yaml_util.dump(config, args.show_secrets)
|
||||
# add the console decoration so the front-end can hide the secrets
|
||||
if not args.show_secrets:
|
||||
output = re.sub(
|
||||
r"(password|key|psk|ssid)\:\s(.*)", r"\1: \\033[5m\2\\033[6m", output
|
||||
)
|
||||
safe_print(output)
|
||||
_LOGGER.info("Configuration is valid!")
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
@ -93,6 +93,10 @@ class DashboardSettings:
|
|||
def using_auth(self):
|
||||
return self.using_password or self.using_ha_addon_auth
|
||||
|
||||
@property
|
||||
def streamer_mode(self):
|
||||
return get_bool_env("ESPHOME_STREAMER_MODE")
|
||||
|
||||
def check_password(self, username, password):
|
||||
if not self.using_auth:
|
||||
return True
|
||||
|
@ -131,7 +135,7 @@ def template_args():
|
|||
"docs_link": docs_link,
|
||||
"get_static_file_url": get_static_file_url,
|
||||
"relative_url": settings.relative_url,
|
||||
"streamer_mode": get_bool_env("ESPHOME_STREAMER_MODE"),
|
||||
"streamer_mode": settings.streamer_mode,
|
||||
"config_dir": settings.config_dir,
|
||||
}
|
||||
|
||||
|
@ -396,7 +400,10 @@ class EsphomeCompileHandler(EsphomeCommandWebSocket):
|
|||
class EsphomeValidateHandler(EsphomeCommandWebSocket):
|
||||
def build_command(self, json_message):
|
||||
config_file = settings.rel_path(json_message["configuration"])
|
||||
return ["esphome", "--dashboard", "config", config_file]
|
||||
command = ["esphome", "--dashboard", "config", config_file]
|
||||
if not settings.streamer_mode:
|
||||
command.append("--show-secrets")
|
||||
return command
|
||||
|
||||
|
||||
class EsphomeCleanMqttHandler(EsphomeCommandWebSocket):
|
||||
|
@ -1147,7 +1154,7 @@ class JsonConfigRequestHandler(BaseHandler):
|
|||
self.send_error(404)
|
||||
return
|
||||
|
||||
args = ["esphome", "config", settings.rel_path(configuration), "--show-secrets"]
|
||||
args = ["esphome", "config", filename, "--show-secrets"]
|
||||
|
||||
rc, stdout, _ = run_system_command(*args)
|
||||
|
||||
|
|
Loading…
Reference in a new issue