Skip to content

Commit

Permalink
Fix Exception condition when container env list is Null
Browse files Browse the repository at this point in the history
  • Loading branch information
mesudip committed Nov 27, 2023
1 parent 29ce168 commit b3690a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nginx_proxy/Container.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def __repr__(self):
@staticmethod
def get_env_map(container: DockerContainer):
# first we get the list of tuples each containing data in form (key, value)
env_list = [x.split("=", 1) for x in container.attrs['Config']['Env']]
container_env=container.attrs['Config']['Env']

env_list = [x.split("=", 1) for x in container_env ] if container_env else []
# convert the environment list into map
return {x[0]: x[1].strip() for x in env_list if len(x) == 2}

Expand Down

0 comments on commit b3690a0

Please sign in to comment.