mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-08-07 17:33:16 +02:00
fix: update letsmesh configuration to disable and correct iata_code casing
This commit is contained in:
+3
-3
@@ -39,7 +39,7 @@ mesh:
|
||||
# Global flood policy - controls whether the repeater allows or denies flooding by default
|
||||
# true = allow flooding globally, false = deny flooding globally
|
||||
# Individual transport keys can override this setting
|
||||
global_flood_allow: false
|
||||
global_flood_allow: true
|
||||
|
||||
radio:
|
||||
# Frequency in Hz (869.618 MHz for EU)
|
||||
@@ -147,8 +147,8 @@ storage:
|
||||
|
||||
|
||||
letsmesh:
|
||||
enabled: true
|
||||
iata_code: "test" # e.g., "SFO", "LHR", "test"
|
||||
enabled: false
|
||||
iata_code: "Test" # e.g., "SFO", "LHR", "Test"
|
||||
broker_index: 0 # Which LetsMesh broker (0=EU, 1=US West)
|
||||
status_interval: 60
|
||||
|
||||
|
||||
@@ -567,7 +567,7 @@ import yaml
|
||||
from collections import OrderedDict
|
||||
|
||||
def merge_yaml_configs(user_config_path, example_config_path, output_path):
|
||||
"""Merge user config with new example config, preserving user values"""
|
||||
"""Merge user config with new example config, preserving user values and protecting critical sections"""
|
||||
try:
|
||||
# Load user config
|
||||
with open(user_config_path, 'r') as f:
|
||||
@@ -577,9 +577,16 @@ def merge_yaml_configs(user_config_path, example_config_path, output_path):
|
||||
with open(example_config_path, 'r') as f:
|
||||
example_config = yaml.safe_load(f) or {}
|
||||
|
||||
# Sections to preserve completely from user config (don't overwrite with example)
|
||||
protected_sections = ['radio', 'sx1262']
|
||||
|
||||
# Deep merge function
|
||||
def deep_merge(base, overlay):
|
||||
for key, value in overlay.items():
|
||||
# Skip protected sections - keep user's version completely
|
||||
if key in protected_sections:
|
||||
continue
|
||||
|
||||
if key in base and isinstance(base[key], dict) and isinstance(value, dict):
|
||||
deep_merge(base[key], value)
|
||||
elif key not in base:
|
||||
@@ -589,6 +596,12 @@ def merge_yaml_configs(user_config_path, example_config_path, output_path):
|
||||
# Start with example config as base (gets all new sections)
|
||||
merged = deep_merge(dict(example_config), user_config)
|
||||
|
||||
# Explicitly preserve protected sections from user config
|
||||
for section in protected_sections:
|
||||
if section in user_config:
|
||||
merged[section] = user_config[section]
|
||||
print(f" ✓ Preserved user {section} configuration")
|
||||
|
||||
# Write merged config
|
||||
with open(output_path, 'w') as f:
|
||||
yaml.dump(merged, f, default_flow_style=False, indent=2)
|
||||
|
||||
Reference in New Issue
Block a user