process volume mounts more efficiently

This commit is contained in:
Asif Bacchus 2019-11-16 16:52:44 -07:00
parent 5d577a47b8
commit ef650b0549

View File

@ -120,24 +120,19 @@ if [ "$WEBROOT_DIR" ]; then
checkExist 'dir' "$WEBROOT_DIR" checkExist 'dir' "$WEBROOT_DIR"
fi fi
# set up volume mounts for config, servers, webroot # set up volume mounts
if [ -z "$CONFIG_DIR" ] && [ -z "$WEBROOT_DIR" ] && [ -z "$SERVERS_DIR" ]; then if [ "$CONFIG_DIR" ]; then
vmount="" vmount="$vmount -v $CONFIG_DIR:/etc/nginx/config"
elif [ "$CONFIG_DIR" ] && [ "$WEBROOT_DIR" ] && [ "$SERVERS_DIR" ]; then
vmount="-v $CONFIG_DIR:/etc/nginx/config/ -v $SERVERS_DIR:/etc/nginx/sites/ -v $WEBROOT_DIR:/usr/share/nginx/html/"
elif [ "$CONFIG_DIR" ] && [ "$SERVERS_DIR" ]; then
vmount="-v $CONFIG_DIR:/etc/nginx/config/ -v $SERVERS_DIR:/etc/nginx/sites/"
elif [ "$CONFIG_DIR" ] && [ "$WEBROOT_DIR" ]; then
vmount="-v $CONFIG_DIR:/etc/nginx/config/ -v $WEBROOT_DIR:/usr/share/nginx/html/"
elif [ "$SERVERS_DIR" ] && [ "$WEBROOT_DIR" ]; then
vmount="-v $SERVERS_DIR:/etc/nginx/sites/ -v $WEBROOT_DIR:/usr/share/nginx/html/"
elif [ "$CONFIG_DIR" ]; then
vmount="-v $CONFIG_DIR:/etc/nginx/config/"
elif [ "$SERVERS_DIR" ]; then
vmount="-v $SERVERS_DIR:/etc/nginx/sites/"
elif [ "$WEBROOT_DIR" ]; then
vmount="-v $WEBROOT_DIR:/usr/share/nginx/html/"
fi fi
if [ "$SERVERS_DIR" ]; then
vmount="$vmount -v $SERVERS_DIR:/etc/nginx/sites"
fi
if [ "$WEBROOT_DIR" ]; then
vmount="$vmount -v $WEBROOT_DIR:/usr/share/nginx/html"
fi
# trim leading whitespace
vmount=${vmount##[[:space:]]}
echo "$vmount"
# process startup parameters # process startup parameters