mirror of
https://github.com/anyproto/any-sync-dockercompose.git
synced 2025-06-08 14:07:02 +09:00
fixed docker-generateconfig/setListenIp.py
This commit is contained in:
parent
249adb5850
commit
be138faf23
2 changed files with 14 additions and 4 deletions
|
@ -16,7 +16,7 @@ REDIS_VERSION=7.2.0-v6
|
||||||
MINIO_VERSION=RELEASE.2024-01-16T16-07-38Z
|
MINIO_VERSION=RELEASE.2024-01-16T16-07-38Z
|
||||||
|
|
||||||
EXTERNAL_LISTEN_HOST="127.0.0.1"
|
EXTERNAL_LISTEN_HOST="127.0.0.1"
|
||||||
#EXTERNAL_LISTEN_HOSTS="192.168.1.2
|
#EXTERNAL_LISTEN_HOSTS="192.168.1.2"
|
||||||
|
|
||||||
ANY_SYNC_NODE_1_HOST=any-sync-node-1
|
ANY_SYNC_NODE_1_HOST=any-sync-node-1
|
||||||
ANY_SYNC_NODE_1_PORT=1001
|
ANY_SYNC_NODE_1_PORT=1001
|
||||||
|
|
|
@ -27,9 +27,16 @@ else:
|
||||||
|
|
||||||
inputYamlFile = sys.argv[1]
|
inputYamlFile = sys.argv[1]
|
||||||
outputYamlFile = sys.argv[2]
|
outputYamlFile = sys.argv[2]
|
||||||
listenHosts = envVars['EXTERNAL_LISTEN_HOSTS'].split()
|
externalListenHosts = envVars.get('EXTERNAL_LISTEN_HOSTS', '127.0.0.1').split()
|
||||||
if 'EXTERNAL_LISTEN_HOST' in envVars:
|
externalListenHost = envVars.get('EXTERNAL_LISTEN_HOST', None)
|
||||||
listenHosts.append(envVars['EXTERNAL_LISTEN_HOST'])
|
print(f"DEBUG: externalListenHosts={externalListenHosts}")
|
||||||
|
print(f"DEBUG: externalListenHost={externalListenHost}")
|
||||||
|
listenHosts = list()
|
||||||
|
for externalListenHost in externalListenHosts:
|
||||||
|
if externalListenHost not in listenHosts:
|
||||||
|
listenHosts.append(externalListenHost)
|
||||||
|
if externalListenHost not in listenHosts:
|
||||||
|
listenHosts.append(externalListenHost)
|
||||||
|
|
||||||
print(f"DEBUG: listenHosts={listenHosts}")
|
print(f"DEBUG: listenHosts={listenHosts}")
|
||||||
|
|
||||||
|
@ -49,6 +56,9 @@ for index, nodes in enumerate(config['nodes']):
|
||||||
# add "quic" listen address
|
# add "quic" listen address
|
||||||
for name,value in envVars.items():
|
for name,value in envVars.items():
|
||||||
if re.match(r"^(ANY_SYNC_.*_PORT)$", name) and value == listenPort:
|
if re.match(r"^(ANY_SYNC_.*_PORT)$", name) and value == listenPort:
|
||||||
|
if re.match(r"^(ANY_SYNC_.*_QUIC_PORT)$", name):
|
||||||
|
# skip port, if PORT == QUIC_PORT
|
||||||
|
continue
|
||||||
quicPortKey = name.replace('_PORT', '_QUIC_PORT')
|
quicPortKey = name.replace('_PORT', '_QUIC_PORT')
|
||||||
quicPortValue = envVars[quicPortKey]
|
quicPortValue = envVars[quicPortKey]
|
||||||
quicListenAddress = 'quic://'+ nodeListenHost +':'+ str(quicPortValue)
|
quicListenAddress = 'quic://'+ nodeListenHost +':'+ str(quicPortValue)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue