<?xml version='1.0' encoding='utf-8'?>

<creole>

    <files>
        <service method='apache' servicelist='ead3_apache'>ead3</service>
        <file name="/etc/ewt/appdata/ead/config.json" source="config_ead.json" mkdir="True"/>
        <file name='/etc/nginx/web.d/ead3.conf' source='ead3.nginx.conf' mkdir='True' rm='True' filelist='ead3_nginx' />
        <file name='/etc/apache2/sites-available/ead3.conf' source='ead3.apache.conf' rm='True' filelist='ead3_apache' />
        <file name='/etc/nginx/sites-enabled/ead3_apache.conf' source='ead3.apache_nginx.conf' rm='True' filelist='ead3_apache' />
        <file name='/etc/eole/flask/available/ead3fileserver.conf' source='ead3fileserver.conf' filelist='ead3_fileserver'/>
        <file name="/srv/salt/top.sls" mkdir="True"/>
        <file name="/var/lib/eole/config/ead3.cfg" source="ead3.services.cfg"/>
    </files>

    <variables>

        <family name='Services'>

            <variable name='test_activer_ead3' type='oui/non' description='Vérifier si l’on peut activer l’interface d’administration du module (EAD3)' />

            <variable name='test_activer_ead3_https' type='oui/non' description='Vérifier si HTTPS Nginx est désactivé pour l’interface d’administration du module (EAD3)' />

            <variable name='activer_ead3' type='oui/non' description='Activer l’interface d’administration du module (EAD3)' mode='expert'>
                <value>non</value>
            </variable>

            <!-- Workaround when eole-reverseproxy is not installed -->
            <variable name='activer_nginx_web' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>
            <variable name='test_activer_nginx_web' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>

            <variable name='nginx_degrade_http' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>

            <!-- Workaround when eole-web is not installed -->
            <variable name='activer_apache' type='oui/non' exists='False' hidden='True'>
                <value>non</value>
            </variable>

            <variable name='activer_saltstack' redefine='True'/>

            <variable name='ead3_upload_path' type='string' description='Chemin de téléversement des fichiers EAD3' mode='expert'>
                <value>/var/lib/eole/ead3files</value>
            </variable>

        </family>

        <family name='Applications web Nginx'>

            <variable name='ead3_http_path' type='string' description='Chemin d’accès de l’application EAD3' mode='expert'>
                <value>/ead</value>
            </variable>

        </family>

        <separators>
            <!-- Make ead3 more readable: each application under its own separator -->
            <separator name='ead3_http_path'>EAD</separator>
        </separators>

    </variables>

    <constraints>

        <!-- User can disable ead3 -->
        <condition name='disabled_if_in' source='activer_ead3'>
            <param>non</param>
            <target type='variable'>ead3_http_path</target>
            <target type='filelist'>ead3_apache</target>
            <target type='filelist'>ead3_nginx</target>
            <target type='servicelist'>ead3_apache</target>
        </condition>

        <!-- Check if service can be enabled on master only:
             - When container is enabled, check only for activer_nginx_web
             - All other cases must check activer_nginx_web and apache
        -->
        <auto name='activate_master_only_web_app' target='test_activer_ead3'>
            <param type='eole' name='mode_conteneur_actif'>mode_conteneur_actif</param>
            <param type='eole' name='activer_nginx_web' hidden='False'>activer_nginx_web</param>
            <param type='eole' name='activer_apache' hidden='False'>activer_apache</param>
        </auto>

        <condition name='disabled_if_in' source='test_activer_ead3'>
            <param>non</param>
            <target type='variable'>activer_ead3</target>
        </condition>

        <!-- ead3 requires HTTPS
             Use calc_multi_condition to by-pass the absence of:

                 “do not disable target if source is disabled”
        -->
        <auto name='calc_multi_condition' target='test_activer_ead3_https'>
            <param>non</param>
            <param type='eole' name='condition_1' hidden='False'>nginx_degrade_http</param>
            <param name='match'>oui</param>
            <param name='mismatch'>non</param>
        </auto>

        <condition name='disabled_if_in' source='test_activer_ead3_https'>
            <param>non</param>
            <target type='variable'>activer_ead3</target>
        </condition>

        <!-- Do not configure Apache if we use Nginx -->
        <condition name='disabled_if_in' source='test_activer_nginx_web' fallback='True'>
            <param>oui</param>
            <target type='filelist'>ead3_apache</target>
            <target type='servicelist'>ead3_apache</target>
        </condition>

        <!-- Do not configure Apache if Apache is disabled -->
        <condition name='disabled_if_in' source='activer_apache' fallback='True'>
            <param>non</param>
            <target type='filelist'>ead3_apache</target>
            <target type='servicelist'>ead3_apache</target>
        </condition>

        <!-- Disable EAD3 will disable SaltStack -->
        <auto name='calc_val_first_value' target='activer_saltstack'>
            <param type='eole' hidden='False'>activer_ead3</param>
            <param>non</param>
        </auto>

    </constraints>

    <help>

        <variable name='test_activer_ead3'>Vérifier que la publication web par Nginx ou Apache est actif</variable>
        <variable name='activer_ead3'>Publier l’interface d’administration du module sur le port standard HTTPS (443)</variable>
        <variable name='ead3_http_path'>Chemin absolu (commençant par un /) sous lequel le service EAD3 sera accessible</variable>
        <variable name='ead3_upload_path'>Chemin absolu (commençant par un /) vers lequel sont téléversés les fichiers provenant de l'action "Gestion de fichier"</variable>

    </help>

</creole>
<!-- vim: ts=4 sw=4 expandtab
-->
