Files
docker_minecraft_server_aut…/app/utils.py

21 lines
511 B
Python

import logging
import os
import socket
def docker_container_mapping():
port_map_str = os.environ.get('PORT_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