Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Added first variables values
Browse files Browse the repository at this point in the history
  • Loading branch information
villadalmine committed Sep 14, 2016
1 parent c91f3f7 commit 35e2d7b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion container_files/bin/configure_php.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#!/bin/bash

log="/tmp/php.log"
date >> $log
echo "Configuring php: " >> $log

echo "Configuring php: " > $log
echo " " >> $log
echo "Checking variables before configuring config files " >> $log

if [[ $MYSQL_HOST && ${MYSQL_HOST-x} ]] && [[ $MYSQL_USER && ${MYSQL_USER-x} ]] && [[ $MYSQL_PASSWORD && ${MYSQL_PASSWORD-x} ]] && [[ $MYSQL_DATABASE && ${MYSQL_DATABASE-x} ]] && [[ $COMANAGE_MAIL_FROM && ${COMANAGE_MAIL_FROM-x} ]] && [[ $COMANAGE_MAIL_HOST && ${COMANAGE_MAIL_HOST-x} ]] && [[ $COMANAGE_MAIL_PORT && ${COMANAGE_MAIL_PORT-x} ]] && [[ $COMANAGE_MAIL_USER && ${COMANAGE_MAIL_USER-x} ]] && [[ $COMANAGE_MAIL_PASS && ${COMANAGE_MAIL_PASS-x} ]]; then
sed -i "s|CHANGE_TO_ENV_MYSQL_HOST|$MYSQL_HOST|g" /opt/etc/php/database.php
sed -i "s|CHANGE_TO_ENV_MYSQL_HOST|$MYSQL_USER|g" /opt/etc/php/database.php
sed -i "s|CHANGE_TO_ENV_MYSQL_PASSWORD|$MYSQL_PASSWORD/g" /opt/etc/php/database.php
sed -i "s|CHANGE_TO_ENV_MYSQL_TABLE|$MYSQL_DATABASE/g" /opt/etc/php/database.php
sed -i "s|CHANGE_TO_COMANAGE_MAIL_FROM|$COMANAGE_MAIL_FROM|g" /opt/etc/php/email.php
sed -i "s|CHANGE_TO_COMANAGE_MAIL_HOST|$COMANAGE_MAIL_HOST|g" /opt/etc/php/email.php
sed -i "s|CHANGE_TO_COMANAGE_MAIL_PORT|$COMANAGE_MAIL_PORT|g" /opt/etc/php/email.php
sed -i "s|CHANGE_TO_COMANAGE_MAIL_USER|$COMANAGE_MAIL_USER|g" /opt/etc/php/email.php
sed -i "s|CHANGE_TO_COMANAGE_MAIL_PASS|$COMANAGE_MAIL_PASS|g" /opt/etc/php/email.php
else
echo "Variables are not totally filled so no configuration was performed" >> $log

fi

0 comments on commit 35e2d7b

Please sign in to comment.