2016-03-25 01:18:05 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# fix key if needed
|
2016-05-14 15:43:46 -07:00
|
|
|
if [ -z "$APP_KEY" ]
|
2016-03-25 01:18:05 -07:00
|
|
|
then
|
2016-05-14 15:43:46 -07:00
|
|
|
echo "Please re-run this container with an environment variable \$APP_KEY"
|
|
|
|
echo "An example APP_KEY you could use is: "
|
|
|
|
php artisan key:generate --show
|
|
|
|
exit
|
2016-03-25 01:18:05 -07:00
|
|
|
fi
|
|
|
|
|
2016-05-14 15:43:46 -07:00
|
|
|
if [ -f /var/lib/snipeit/ssl/snipeit-ssl.crt -a -f /var/lib/snipeit/ssl/snipeit-ssl.key ]
|
2016-03-25 01:18:05 -07:00
|
|
|
then
|
|
|
|
a2enmod ssl
|
|
|
|
else
|
|
|
|
a2dismod ssl
|
|
|
|
fi
|
|
|
|
|
2016-05-14 15:43:46 -07:00
|
|
|
# create data directories
|
2017-03-31 13:48:50 -07:00
|
|
|
for dir in 'data/private_uploads' 'data/uploads' 'data/uploads/avatars' 'data/uploads/barcodes' 'data/uploads/models' 'data/uploads/suppliers' 'dumps'; do
|
2016-05-14 15:43:46 -07:00
|
|
|
mkdir -p "/var/lib/snipeit/$dir"
|
|
|
|
done
|
|
|
|
|
|
|
|
chown -R docker:root /var/lib/snipeit/data/*
|
|
|
|
chown -R docker:root /var/lib/snipeit/dumps
|
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
. /etc/apache2/envvars
|
|
|
|
exec apache2 -DNO_DETACH < /dev/null
|