#!/bin/bash

# enable strict mode
set -euo pipefail
IFS=$'\n\t'

# Make sure directories are writable
WRITABLE_DIRECTORIES=('application/Proxies' 'public/tmp')
# APP_HOME is provided by the Dockerfile

for DIR in "${WRITABLE_DIRECTORIES[@]}"; do
  chown -R www-data "${APP_HOME}/${DIR}"
done

/usr/sbin/apache2ctl -k start -D FOREGROUND
