<?php

/**
 * Drupal VM drush aliases.
 *
 * @see example.aliases.drushrc.php.
 */

{% macro alias(host, root) -%}
{%- if root not in _devtool_docroots %}
$aliases['{{ host }}'] = array(
  'uri' => '{{ host }}',
  'root' => '{{ root }}',
);

{% endif -%}
{% endmacro -%}

{% block aliases -%}
{%- if drupalvm_webserver == 'apache' -%}
  {%- for vhost in apache_vhosts -%}
    {{ alias(vhost.servername, vhost.documentroot) }}
    {%- if vhost.serveralias is defined -%}
      {%- for serveralias in vhost.serveralias.split() -%}
        {{ alias(serveralias, vhost.documentroot) }}
      {%- endfor -%}
    {%- endif -%}
  {%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
  {%- for host in nginx_vhosts -%}
    {%- for server_name in host.server_name.split() -%}
      {{ alias(server_name, host.root) }}
    {%- endfor -%}
  {%- endfor -%}
{%- endif -%}
{%- endblock %}