#!/bin/bash
##
## Écrit un fichier minimal de configuration posh
## pour être sûr de le créer avant que mysql_pwd.py ne le modifie
## puis que le postreconf appel la génération du fichier complet

if [ -f /usr/bin/ParseDico ];then
    #EOLE 2.3
    . ParseDico
    . /etc/eole/containers.conf
else
    #EOLE 2.4
    activer_envole=$(CreoleGet activer_envole)
    adresse_ip_mysql=$(CreoleGet adresse_ip_mysql)
    container_path_web=$(CreoleGet container_path_web)
fi


if [ "$activer_envole" == "oui" ]
then
POSH_CONFIG_FILE=${container_path_web}/var/www/html/posh/includes/config.inc.php
echo "<?php
define(\"__SERVER\",\"$adresse_ip_mysql\");
define(\"__LOGIN\",\"posh\");
define(\"__PASS\",\"mot_de_passe_mysql\");
define(\"__DB\",\"posh\");
define(\"__KEY\",\"cle_d_authentification_de_l_api\");
define(\"__DBTYPE\",\"mysql\");
?>" > $POSH_CONFIG_FILE
fi
exit 0
