Fix DockerHandler and NginxHandler bugs

This commit is contained in:
DerTyp7
2023-12-12 13:27:35 +01:00
parent 732650e31e
commit 5775cb087a
6 changed files with 23 additions and 36 deletions

View File

@@ -1,19 +1,23 @@
import logging
import os
import socket
import socket
def docker_container_mapping():
port_ip_map_str = os.environ.get('PORT_MAP')
# Convert the environment variable to a Python dictionary
port_ip_map = {}
for line in port_ip_map_str.split('\n'):
if line: # ignore empty lines
port, ip = line.split(':')
port_ip_map[port.strip()] = ip.strip()
port_map_str = os.environ.get('PORT_MAP')
return port_ip_map
port_map = {}
for line in port_map_str.split('\n'):
if line:
port, name = line.split(':')
port_map[port.strip()] = name.strip().replace(
"'", "").replace('"', "").strip()
# print port map for debugging
logging.info('PORT_MAP:')
for port in port_map:
logging.info(f'{port} -> {port_map[port]}')
return port_map
def get_ip_by_dns_name(dns_name):