mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2024-11-23 00:52:02 +01:00
Fix indentations and add reload_nginx function in library
This commit is contained in:
parent
1c6d70b93f
commit
a263aad670
@ -3,10 +3,10 @@ declare -r START_HEADER='## Start of configuration add by letsencrypt container'
|
||||
declare -r END_HEADER='## End of configuration add by letsencrypt container'
|
||||
|
||||
add_location_configuration() {
|
||||
local domain="$1"
|
||||
[[ -z "$domain" || ! -f "${VHOST_DIR}/${domain}" ]] && domain=default
|
||||
[[ -f "${VHOST_DIR}/${domain}" && \
|
||||
-n $(sed -n "/$START_HEADER/,/$END_HEADER/p" "${VHOST_DIR}/${domain}") ]] && return 0
|
||||
local domain="$1"
|
||||
[[ -z "$domain" || ! -f "${VHOST_DIR}/${domain}" ]] && domain=default
|
||||
[[ -f "${VHOST_DIR}/${domain}" && \
|
||||
-n $(sed -n "/$START_HEADER/,/$END_HEADER/p" "${VHOST_DIR}/${domain}") ]] && return 0
|
||||
echo "$START_HEADER" > "${VHOST_DIR}/${domain}".new
|
||||
cat /app/nginx_location.conf >> "${VHOST_DIR}/${domain}".new
|
||||
echo "$END_HEADER" >> "${VHOST_DIR}/${domain}".new
|
||||
@ -21,3 +21,10 @@ remove_all_location_configurations() {
|
||||
sed -i "/$START_HEADER/,/$END_HEADER/d" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
reload_nginx() {
|
||||
if [[ -n "$NGINX_PROXY_CID" ]]; then
|
||||
/usr/bin/docker exec -t $NGINX_PROXY_CID \
|
||||
sh -c '/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf;nginx -s reload'
|
||||
fi
|
||||
}
|
||||
|
@ -7,21 +7,16 @@ acme_ca_uri="${ACME_CA_URI:-https://acme-v01.api.letsencrypt.org/directory}"
|
||||
|
||||
source /app/functions.lib
|
||||
|
||||
reload_nginx() {
|
||||
/usr/bin/docker exec -t $NGINX_PROXY_CID \
|
||||
sh -c '/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf;nginx -s reload'
|
||||
}
|
||||
|
||||
update_certs() {
|
||||
[[ ! -f "$DIR"/letsencrypt_service_data ]] && return
|
||||
|
||||
# Load relevant container settings
|
||||
unset LETSENCRYPT_CONTAINERS
|
||||
unset LETSENCRYPT_CONTAINERS
|
||||
source "$DIR"/letsencrypt_service_data
|
||||
|
||||
reload_nginx='false'
|
||||
for cid in "${LETSENCRYPT_CONTAINERS[@]}"; do
|
||||
# Derive host and email variable names
|
||||
# Derive host and email variable names
|
||||
host_varname="LETSENCRYPT_${cid}_HOST"
|
||||
# Array variable indirection hack: http://stackoverflow.com/a/25880676/350221
|
||||
hosts_array=$host_varname[@]
|
||||
|
Loading…
Reference in New Issue
Block a user