refactored naming conventions for improved readability

This commit is contained in:
alexktz 2020-05-06 23:48:45 -04:00
parent b9abd8676a
commit 43291cf96e

View File

@ -2,82 +2,82 @@
---
version: "2"
services:
{% for item in containers %}
{% if item.active %}
{{ item.service_name }}:
image: {{ item.image }}
container_name: {{ item.container_name }}
{% if item.network_mode is defined %}
network_mode: {{ item.network_mode }}
{% for container in containers %}
{% if container.active %}
{{ container.service_name }}:
image: {{ container.image }}
container_name: {{ container.container_name }}
{% if container.network_mode is defined %}
network_mode: {{ container.network_mode }}
{% endif %}
{% if item.volumes is defined %}
{% if container.volumes is defined %}
volumes:
{% for item in item.volumes %}
- {{ item }}
{% for volume in container.volumes %}
- {{ volume }}
{% endfor %}
{% endif %}
{% if item.labels is defined %}
{% if container.labels is defined %}
labels:
{% for label in item.labels %}
{% for label in container.labels %}
- {{ label }}
{% endfor %}
{% endif %}
{% if item.ports is defined %}
{% if container.ports is defined %}
ports:
{% for item in item.ports %}
- {{ item }}
{% for port in container.ports %}
- {{ port }}
{% endfor %}
{% endif %}
{% if ( item.environment is defined ) or ( item.include_global_env_vars ) %}
{% if ( container.environment is defined ) or ( container.include_global_env_vars ) %}
environment:
{% if item.include_global_env_vars %}
{% for item2 in global_env_vars %}
- {{ item2 }}
{% if container.include_global_env_vars %}
{% for global_var in global_env_vars %}
- {{ global_var }}
{% endfor %}
{% endif %}
{% if item.environment is defined %}
{% for item in item.environment %}
- {{ item }}
{% if container.environment is defined %}
{% for env_var in container.environment %}
- {{ env_var }}
{% endfor %}
{% endif %}
{% endif %}
{% if item.depends_on is defined %}
{% if container.depends_on is defined %}
depends_on:
{% for item in item.depends_on %}
- {{ item }}
{% for dependent in container.depends_on %}
- {{ dependent }}
{% endfor %}
{% endif %}
{% if item.hostname is defined %}
hostname: {{ item.hostname }}
{% if container.hostname is defined %}
hostname: {{ container.hostname }}
{% endif %}
{% if item.mem_limit is defined %}
mem_limit: {{ item.mem_limit }}
{% if container.mem_limit is defined %}
mem_limit: {{ container.mem_limit }}
{% endif %}
{% if item.restart is defined %}
restart: {{ item.restart }}
{% if container.restart is defined %}
restart: {{ container.restart }}
{% endif %}
{% if item.cap_add is defined %}
{% if container.cap_add is defined %}
cap_add:
{% for item in item.cap_add %}
- {{ item }}
{% for cap in container.cap_add %}
- {{ cap }}
{% endfor %}
{% endif %}
{% if item.command is defined %}
command: {{ item.command }}
{% if container.command is defined %}
command: {{ container.command }}
{% endif %}
{% if item.security_opt is defined %}
{% if container.security_opt is defined %}
security_opt:
{% for item in item.security_opt %}
- {{ item }}
{% for sec_opt in container.security_opt %}
- {{ sec_opt }}
{% endfor %}
{% endif %}
{% if item.shm_size is defined %}
shm_size: {{ item.shm_size }}
{% if container.shm_size is defined %}
shm_size: {{ container.shm_size }}
{% endif %}
{% if item.dns is defined %}
{% if container.dns is defined %}
dns:
{% for item in item.dns %}
- {{ item }}
{% for dns_entry in container.dns %}
- {{ dns_entry }}
{% endfor %}
{% endif %}
{% endif %}