1
0
Fork 0
mirror of synced 2024-07-02 05:00:33 +12:00
appwrite/docker/entrypoint.sh

33 lines
1,011 B
Bash
Raw Normal View History

2019-05-09 18:54:39 +12:00
#!/bin/bash
2019-10-06 13:09:19 +13:00
export PHP_VERSION=$PHP_VERSION
2019-05-09 18:54:39 +12:00
chown -Rf www-data.www-data /usr/share/nginx/html/
# Function to update the fpm configuration to make the service environment variables available
function setEnvironmentVariable() {
if [ -z "$2" ]; then
echo "Environment variable '$1' not set."
return
fi
# Check whether variable already exists
2019-10-06 13:09:19 +13:00
if grep -q $1 /etc/php/$PHP_VERSION/fpm/pool.d/www.conf; then
2019-05-09 18:54:39 +12:00
# Reset variable
2019-10-06 13:09:19 +13:00
sed -i "s/^env\[$1.*/env[$1] = $2/g" /etc/php/$PHP_VERSION/fpm/pool.d/www.conf
2019-05-09 18:54:39 +12:00
else
# Add variable
2019-10-06 13:09:19 +13:00
echo "env[$1] = $2" >> /etc/php/$PHP_VERSION/fpm/pool.d/www.conf
2019-05-09 18:54:39 +12:00
fi
}
# Grep for variables that look like MySQL (APP_)
for _curVar in $(env | grep _APP_ | awk -F = '{print $1}');do
2019-05-09 18:54:39 +12:00
# awk has split them by the equals sign
# Pass the name and value to our function
setEnvironmentVariable ${_curVar} ${!_curVar}
done
# Start supervisord and services
2019-10-06 13:09:19 +13:00
/usr/bin/supervisord -n -c /etc/supervisord.conf