{% macro comma_list(items) -%}
    {%- for item in items -%}
{{ item }}{% if not loop.last %},{% endif %}
    {%- endfor -%}
{%- endmacro -%}

# Generated by pyinfra-etcd

# Node
#

ETCD_NAME={{ host.data.etcd_name or host.name }}
ETCD_DATA_DIR={{ host.data.etcd_data_dir }}

ETCD_INITIAL_ADVERTISE_PEER_URLS={{ comma_list(get_urls(host, 'peer')) }}
ETCD_LISTEN_PEER_URLS={{ comma_list(get_urls(host, 'peer')) }}

ETCD_ADVERTISE_CLIENT_URLS={{ comma_list(get_urls(host, 'client')) }}
ETCD_LISTEN_CLIENT_URLS={{ comma_list(get_urls(host, 'client')) }}


# Clustering
#

ETCD_INITIAL_CLUSTER={{ comma_list(cluster_node_urls) }}
ETCD_INITIAL_CLUSTER_STATE={{ host.data.etcd_initial_cluster_state }}
ETCD_INITIAL_CLUSTER_TOKEN={{ host.data.etcd_initial_cluster_token }}
