#!/bin/sh

if [ ! -f "$PWD/.env" ]; then
    cp .env.example .env
fi
if [ ! -d "$PWD/vendor" ]; then
    # vendor not exist
    composer install
fi

source "$PWD/.env"
# Do something after get environment

echo '' > ./var/log/apache2_error.log
echo '' > ./var/log/apache2_access.log

# new file
echo 'export APACHE_RUN_USER=root' > /etc/apache2/envvars
# append
echo 'export APACHE_RUN_GROUP=root' >>  /etc/apache2/envvars

httpd -D FOREGROUND
