From c54d69f06aab4ae26c501f56420fda70b7131e1d Mon Sep 17 00:00:00 2001 From: yungwine Date: Thu, 25 Sep 2025 16:48:14 +0200 Subject: [PATCH] allow custom validator ip and validator, vc, ls ports --- mytoninstaller/mytoninstaller.py | 5 +++-- mytoninstaller/settings.py | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mytoninstaller/mytoninstaller.py b/mytoninstaller/mytoninstaller.py index 06e9f7da..e728ef72 100644 --- a/mytoninstaller/mytoninstaller.py +++ b/mytoninstaller/mytoninstaller.py @@ -51,8 +51,9 @@ def Init(local, console): # create variables local.buffer.user = get_current_user() local.buffer.vuser = "validator" - local.buffer.cport = random.randint(2000, 65000) - local.buffer.lport = random.randint(2000, 65000) + local.buffer.cport = int(os.getenv('VALIDATOR_CONSOLE_PORT', random.randint(2000, 65000))) + local.buffer.lport = int(os.getenv('LITESERVER_PORT', random.randint(2000, 65000))) + local.buffer.vport = int(os.getenv('VALIDATOR_PORT', random.randint(2000, 65000))) # this funciton injects MyPyClass instance def inject_globals(func): diff --git a/mytoninstaller/settings.py b/mytoninstaller/settings.py index 6288f6c8..648094f0 100644 --- a/mytoninstaller/settings.py +++ b/mytoninstaller/settings.py @@ -45,6 +45,7 @@ def FirstNodeSettings(local): validatorAppPath = local.buffer.validator_app_path globalConfigPath = local.buffer.global_config_path vconfig_path = local.buffer.vconfig_path + vport = local.buffer.vport if os.getenv('ARCHIVE_TTL'): archive_ttl = int(os.getenv('ARCHIVE_TTL')) @@ -100,9 +101,10 @@ def FirstNodeSettings(local): add2systemd(name="validator", user=vuser, start=cmd, pre='/bin/sleep 2') # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\"" - # Получить внешний ip адрес - ip = get_own_ip() - vport = random.randint(2000, 65000) + if os.getenv('PUBLIC_IP'): + ip = os.getenv('PUBLIC_IP') + else: + ip = get_own_ip() addr = "{ip}:{vport}".format(ip=ip, vport=vport) local.add_log("Use addr: " + addr, "debug")