feat: add default security configuration for repeater in load_config to fix from previous versions.

This commit is contained in:
Lloyd
2026-03-24 09:23:16 +00:00
parent c35733e8c4
commit 7bcab773dd

View File

@@ -77,6 +77,23 @@ def load_config(config_path: Optional[str] = None) -> Dict[str, Any]:
if "mesh" not in config:
config["mesh"] = {}
# Ensure repeater.security exists with defaults for upgrades from older configs
if "repeater" not in config:
config["repeater"] = {}
if "security" not in config["repeater"]:
logger.warning(
"No 'security' section found under 'repeater' in config. "
"Adding defaults — please review and update passwords."
)
config["repeater"]["security"] = {
"max_clients": 1,
"admin_password": "admin123",
"guest_password": "guest123",
"allow_read_only": False,
"jwt_secret": "",
"jwt_expiry_minutes": 60,
}
# Only auto-generate identity_key if not provided
if "identity_key" not in config["mesh"]:
config["mesh"]["identity_key"] = _load_or_create_identity_key()