Commit 2ad20cc3 authored by Lisa's avatar Lisa

fix: default wss:// URL, better JSON error messages

parent 479136ed
...@@ -47,7 +47,7 @@ logger = logging.getLogger(__name__) ...@@ -47,7 +47,7 @@ logger = logging.getLogger(__name__)
DEFAULT_GATEWAY_TOKEN = 'GATEWAY_TOKEN_MUST_BE_PROVIDED' DEFAULT_GATEWAY_TOKEN = 'GATEWAY_TOKEN_MUST_BE_PROVIDED'
DEFAULT_CONFIG = { DEFAULT_CONFIG = {
'gateway_url': 'ws://127.0.0.1:8765', 'gateway_url': 'wss://localhost:8765',
'node_name': 'unknown', 'node_name': 'unknown',
'token': DEFAULT_GATEWAY_TOKEN, 'token': DEFAULT_GATEWAY_TOKEN,
'sexec_path': '~/.config/hermes-node/sexec/sexec.sh', 'sexec_path': '~/.config/hermes-node/sexec/sexec.sh',
...@@ -438,9 +438,15 @@ class NodeAgent: ...@@ -438,9 +438,15 @@ class NodeAgent:
cfg_path = Path(path).expanduser() if path else Path.home() / '.config' / 'hermes-node' / 'config.json' cfg_path = Path(path).expanduser() if path else Path.home() / '.config' / 'hermes-node' / 'config.json'
if not cfg_path.exists(): if not cfg_path.exists():
logger.error(f"Config not found: {cfg_path}") logger.error(f"Config not found: {cfg_path}")
logger.error(f"Run the installer or copy config-template.json to {cfg_path}")
sys.exit(1) sys.exit(1)
try:
with open(cfg_path) as f: with open(cfg_path) as f:
data = json.load(f) data = json.load(f)
except json.JSONDecodeError as e:
logger.error(f"Config file is not valid JSON: {e}")
logger.error(f"File: {cfg_path}")
sys.exit(1)
# Merge defaults # Merge defaults
merged = {**DEFAULT_CONFIG, **data} merged = {**DEFAULT_CONFIG, **data}
if not merged['token']: if not merged['token']:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment