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