Skip to content

Commit 56761c6

Browse files
committed
--copy-service friendly
1 parent d3875df commit 56761c6

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Add your https server certificate, key and the CA certificate (if any) here
2-
or during docker run mount a data volume with thoses files to /container/service/phpldapadmin/assets/apache2/certs
2+
or during docker run mount a data volume with those files to /container/service/phpldapadmin/assets/apache2/certs

image/service/phpldapadmin/startup.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@
44
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/log-helper
55
log-helper level eq trace && set -x
66

7+
#
8+
# HTTPS config
9+
#
10+
if [ "${PHPLDAPADMIN_HTTPS,,}" == "true" ]; then
711

8-
FIRST_START_DONE="${CONTAINER_STATE_DIR}/docker-phpldapadmin-first-start-done"
9-
# container first start
10-
if [ ! -e "$FIRST_START_DONE" ]; then
12+
log-helper info "Set apache2 https config..."
1113

12-
#
13-
# HTTPS config
14-
#
15-
if [ "${PHPLDAPADMIN_HTTPS,,}" == "true" ]; then
14+
# generate a certificate and key if files don't exists
15+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/:cfssl/assets/tool/cfssl-helper
16+
cfssl-helper phpldapadmin "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CRT_FILENAME" "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_KEY_FILENAME" "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME"
1617

17-
log-helper info "Set apache2 https config..."
18+
# add CA certificat config if CA cert exists
19+
if [ -e "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME" ]; then
20+
sed -i "s/#SSLCACertificateFile/SSLCACertificateFile/g" ${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/https.conf
21+
fi
1822

19-
# check certificat and key or create it
20-
cfssl-helper phpldapadmin "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CRT_FILENAME" "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_KEY_FILENAME" "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME"
23+
ln -sf ${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/https.conf /etc/apache2/sites-available/phpldapadmin.conf
24+
#
25+
# HTTP config
26+
#
27+
else
28+
log-helper info "Set apache2 http config..."
29+
ln -sf ${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/http.conf /etc/apache2/sites-available/phpldapadmin.conf
30+
fi
2131

22-
# add CA certificat config if CA cert exists
23-
if [ -e "${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/certs/$PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME" ]; then
24-
sed -i "s/#SSLCACertificateFile/SSLCACertificateFile/g" ${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf
25-
fi
32+
a2ensite phpldapadmin | log-helper debug
2633

27-
ln -s ${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/phpldapadmin-ssl.conf /etc/apache2/sites-available/phpldapadmin-ssl.conf
28-
a2ensite phpldapadmin-ssl | log-helper info
2934

30-
#
31-
# HTTP config
32-
#
33-
else
34-
log-helper info "Set apache2 http config..."
35-
ln -s ${CONTAINER_SERVICE_DIR}/phpldapadmin/assets/apache2/phpldapadmin.conf /etc/apache2/sites-available/phpldapadmin.conf
36-
a2ensite phpldapadmin | log-helper info
37-
fi
35+
FIRST_START_DONE="${CONTAINER_STATE_DIR}/docker-phpldapadmin-first-start-done"
36+
# container first start
37+
if [ ! -e "$FIRST_START_DONE" ]; then
3838

3939
#
4040
# phpLDAPadmin directory is empty, we use the bootstrap

0 commit comments

Comments
 (0)