Skip to content

Commit 1d97ca8

Browse files
authored
Merge pull request #487 from yungwine/args
allow custom validator ip and validator, vc, ls ports
2 parents c1911c9 + c54d69f commit 1d97ca8

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mytoninstaller/mytoninstaller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ def Init(local, console):
5151
# create variables
5252
local.buffer.user = get_current_user()
5353
local.buffer.vuser = "validator"
54-
local.buffer.cport = random.randint(2000, 65000)
55-
local.buffer.lport = random.randint(2000, 65000)
54+
local.buffer.cport = int(os.getenv('VALIDATOR_CONSOLE_PORT', random.randint(2000, 65000)))
55+
local.buffer.lport = int(os.getenv('LITESERVER_PORT', random.randint(2000, 65000)))
56+
local.buffer.vport = int(os.getenv('VALIDATOR_PORT', random.randint(2000, 65000)))
5657

5758
# this funciton injects MyPyClass instance
5859
def inject_globals(func):

mytoninstaller/settings.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def FirstNodeSettings(local):
4545
validatorAppPath = local.buffer.validator_app_path
4646
globalConfigPath = local.buffer.global_config_path
4747
vconfig_path = local.buffer.vconfig_path
48+
vport = local.buffer.vport
4849

4950
if os.getenv('ARCHIVE_TTL'):
5051
archive_ttl = int(os.getenv('ARCHIVE_TTL'))
@@ -100,9 +101,10 @@ def FirstNodeSettings(local):
100101

101102
add2systemd(name="validator", user=vuser, start=cmd, pre='/bin/sleep 2') # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\""
102103

103-
# Получить внешний ip адрес
104-
ip = get_own_ip()
105-
vport = random.randint(2000, 65000)
104+
if os.getenv('PUBLIC_IP'):
105+
ip = os.getenv('PUBLIC_IP')
106+
else:
107+
ip = get_own_ip()
106108
addr = "{ip}:{vport}".format(ip=ip, vport=vport)
107109
local.add_log("Use addr: " + addr, "debug")
108110

0 commit comments

Comments
 (0)