forked from libresh/docker-vimbadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·37 lines (27 loc) · 1.52 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·37 lines (27 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash -eu
# setup jobs that need to be run only once when creating the container
# set permissions - only var has to be writable for the htuser
path='/var/www/html'
htuser='www-data'
chown -R root:root ${path}/
chown -R ${htuser}:${htuser} ${path}/var
# copy .htaccess, remove default subpath /vimbadmin as we want to run directly on / on our own vhost
cp ${INSTALL_PATH}/public/.htaccess.dist ${INSTALL_PATH}/public/.htaccess
sed -i "s/\/vimbadmin//g" ${INSTALL_PATH}/public/.htaccess
sed -i "s/SetEnv APPLICATION_ENV production/SetEnv APPLICATION_ENV docker/" ${INSTALL_PATH}/public/.htaccess
# copy default configuration
cp ${INSTALL_PATH}/application/configs/application.ini.dist ${INSTALL_PATH}/application/configs/application.ini.base
# setup salts
APP_CONFIG=${INSTALL_PATH}/application/configs/application.ini.base
# set random rememberme salt
SALT=`</dev/urandom tr -dc 'A-Za-z0-9!#%()*+,-./:;<>?@[\]^_{|}~' | head -c 64 ; echo`
sed -i "/resources.auth.oss.rememberme.salt/d" ${APP_CONFIG}
sed -i "/\[user\]/a resources.auth.oss.rememberme.salt = '${SALT}'" ${APP_CONFIG}
# set crypt default
sed -i "/defaults.mailbox.password_scheme/d" ${APP_CONFIG}
sed -i "/\[user\]/a defaults.mailbox.password_scheme = 'crypt:sha512'" ${APP_CONFIG}
# turn off errors for production
sed -i "s/startup_errors = 1/startup_errors = 0/" ${APP_CONFIG}
sed -i "s/display_errors = 1/display_errors = 0/" ${APP_CONFIG}
sed -i "s/displayExceptions = 1/displayExceptions = 0/" ${APP_CONFIG}
printf "\n\n[docker : production]\n\n" >> ${APP_CONFIG}