Skip to content

Commit 65a0f09

Browse files
authored
Merge pull request #17 from devilbox/release-0.22
Allow for global overwritable vhost-gen templates
2 parents 2a01724 + a4a5c49 commit 65a0f09

4 files changed

Lines changed: 35 additions & 0 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ rebuild: pull
1414
docker build --no-cache -t $(image) .
1515
cd build; ./gen-readme.sh $(image)
1616

17+
tag:
18+
docker tag $(image) $(image):$(ARG)
19+
1720
test:
1821
.ci/start-ci.sh $(image) $(ARG)
1922

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ This Docker container adds a lot of injectables in order to customize it to your
162162
| /etc/httpd-custom.d | Mount this directory to add outside configuration files (`*.conf`) to Apache |
163163
| /var/www/default | Apache default virtual host base path (contains by default `htdocs/` and `cfg/` |
164164
| /shared/httpd | Apache mass virtual host root directory |
165+
| /etc/vhost-gen.d | [vhost-gen](https://github.com/devilbox/vhost-gen) directory for custom templates. Copy and customize [apache24.yml](https://github.com/devilbox/vhost-gen/blob/master/etc/templates/apache24.yml) into this mounted directory for global vhost customizations |
165166

166167

167168
#### Default ports

data/docker-entrypoint.d/07-vhost-gen.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@ set -o pipefail
99
# Functions
1010
############################################################
1111

12+
###
13+
### Copy custom vhost-gen template
14+
###
15+
vhost_gen_copy_custom_template() {
16+
local input_dir="${1}"
17+
local output_dir="${2}"
18+
local template_name="${3}"
19+
local debug="${4}"
20+
21+
if [ ! -d "${input_dir}" ]; then
22+
run "mkdir -p ${input_dir}" "${debug}"
23+
fi
24+
25+
if [ -f "${input_dir}/${template_name}" ]; then
26+
log "info" "vhost-gen: applying customized global template: ${template_name}" "${debug}"
27+
run "cp ${input_dir}/${template_name} ${output_dir}/${template_name}" "${debug}"
28+
else
29+
log "info" "vhost-gen: no customized template found" "${debug}"
30+
fi
31+
}
32+
33+
1234
###
1335
### Set PHP_FPM
1436
###

data/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ CA_CRT=/ca/devilbox-ca.crt
2121

2222
# Path to scripts to source
2323
CONFIG_DIR="/docker-entrypoint.d"
24+
VHOST_GEN_DIR="/etc/vhost-gen/templates"
25+
VHOST_GEN_CUST_DIR="/etc/vhost-gen.d"
2426

2527

2628
# Wait this many seconds to start watcherd after httpd has been started
@@ -135,6 +137,13 @@ else
135137
log "info" "Disabling PHP 5.2 compat mode" "${DEBUG_LEVEL}"
136138
fi
137139

140+
141+
###
142+
### Copy custom vhost-gen template
143+
###
144+
vhost_gen_copy_custom_template "${VHOST_GEN_CUST_DIR}" "${VHOST_GEN_DIR}" "apache22.yml" "${DEBUG_LEVEL}"
145+
146+
138147
###
139148
### Enable and configure PHP-FPM
140149
###

0 commit comments

Comments
 (0)