From d4d869312e8d6a4be51ffe565548f19407349b38 Mon Sep 17 00:00:00 2001 From: lichenblankie Date: Thu, 26 Mar 2026 20:13:35 -0700 Subject: [PATCH] added default transport node New TinyWeb instances now auto-connect to reticulum.derickphan.com:4242 so users get internet mesh connectivity out of the box without any manual Reticulum configuration. Env var overrides still supported. --- app.py | 36 +++++++++++++++++++++++++++++++++++- entrypoint.sh | 12 +++--------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 2149429..32bcb59 100644 --- a/app.py +++ b/app.py @@ -11,6 +11,8 @@ from gateway import GatewayState, GatewayHandler, GATEWAY_PORT APP_NAME = "tinyweb" ASPECTS = ["server"] IDENTITY_FILE = "tinyweb_identity" +DEFAULT_TRANSPORT_HOST = "reticulum.derickphan.com" +DEFAULT_TRANSPORT_PORT = 4242 def load_or_create_identity(): @@ -40,9 +42,41 @@ def start_gateway(reticulum): thread.start() +def ensure_rns_config(config_dir): + """Generate a default Reticulum config with internet transport if none exists.""" + if config_dir is None: + config_dir = os.path.expanduser("~/.reticulum") + config_file = os.path.join(config_dir, "config") + if os.path.exists(config_file): + return + os.makedirs(config_dir, exist_ok=True) + with open(config_file, "w") as f: + f.write(f"""[reticulum] + enable_transport = False + share_instance = Yes + +[logging] + loglevel = 4 + +[interfaces] + [[Default Interface]] + type = AutoInterface + enabled = Yes + + [[TCP Transport]] + type = TCPClientInterface + enabled = yes + target_host = {DEFAULT_TRANSPORT_HOST} + target_port = {DEFAULT_TRANSPORT_PORT} +""") + print(f"Created Reticulum config at {config_file}") + + def main(): init_db() - reticulum = RNS.Reticulum(configdir=os.environ.get("RNS_CONFIG_DIR")) + config_dir = os.environ.get("RNS_CONFIG_DIR") + ensure_rns_config(config_dir) + reticulum = RNS.Reticulum(configdir=config_dir) identity = load_or_create_identity() destination = RNS.Destination( diff --git a/entrypoint.sh b/entrypoint.sh index 4131973..35d52bd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,19 +20,13 @@ if [ ! -f "$CONFIG_FILE" ]; then [[Default Interface]] type = AutoInterface enabled = Yes -EOF - if [ -n "$RNS_TCP_HOST" ]; then - RNS_TCP_PORT="${RNS_TCP_PORT:-4242}" - cat >> "$CONFIG_FILE" <