-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-php-entrypoint
More file actions
48 lines (38 loc) · 1.15 KB
/
docker-php-entrypoint
File metadata and controls
48 lines (38 loc) · 1.15 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
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
if [[ -n "${DEBUG}" ]]; then
set -x
fi
# Backwards compatibility for old env vars names.
_backwards_compatibility() {
declare -A vars
# vars[DEPRECATED]="ACTUAL"
vars[SSMTP_SERVERT]="MSMTP_SERVER"
vars[SSMTP_PORT]="MSMTP_PORT"
for i in "${!vars[@]}"; do
# Use value from old var if it's not empty and the new is.
if [[ -n "${!i}" && -z "${!vars[$i]}" ]]; then
export ${vars[$i]}="${!i}"
fi
done
}
_gotpl() {
if [[ -f "/etc/gotpl/$1" ]]; then
gotpl "/etc/gotpl/$1" > "$2"
fi
}
process_templates() {
_backwards_compatibility
_gotpl "msmtp.conf.tmpl" "/etc/msmtprc"
_gotpl "vhost.conf.tmpl" "/etc/apache2/sites-available/000-default.conf"
_gotpl "vhostssl.conf.tmpl" "/etc/apache2/sites-available/default-ssl.conf"
_gotpl "php.settings.tmpl" "/usr/local/etc/php/conf.d/custom-php-settings.ini"
}
process_templates
# https://github.com/docker-library/php/blob/master/7.3/buster/apache/docker-php-entrypoint
# Add default official image command
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- apache2-foreground "$@"
fi
exec "$@"