diff --git a/src/scripts/entrypoint.sh b/src/scripts/entrypoint.sh index 71d433e..ef57e61 100644 --- a/src/scripts/entrypoint.sh +++ b/src/scripts/entrypoint.sh @@ -7,6 +7,9 @@ trap "kill 0" EXIT # Source in util.sh so we can have our nice tools . $(cd $(dirname $0); pwd)/util.sh +# first include any user configs if they've been mounted +link_user_configs + # Immediately run auto_enable_configs so that nginx is in a runnable state auto_enable_configs diff --git a/src/scripts/startup/link_user_configs.sh b/src/scripts/startup/link_user_configs.sh deleted file mode 100755 index eb987a2..0000000 --- a/src/scripts/startup/link_user_configs.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -SOURCE_DIR=/etc/nginx/user.conf.d -TARGET_DIR=/etc/nginx/conf.d - -echo "symlinking scripts from ${SOURCE_DIR} to ${TARGET_DIR}" - -if [ ! -d "$SOURCE_DIR" ]; then - echo "no ${SOURCE_DIR}, nothing to do." -else - for conf in ${SOURCE_DIR}/*.conf; do - echo "symlinking: ${conf}" "${TARGET_DIR}/$(basename ${conf})" - ln -s "${conf}" "${TARGET_DIR}/$(basename ${conf})" - done -fi diff --git a/src/scripts/util.sh b/src/scripts/util.sh index 2c47c7d..02bff88 100644 --- a/src/scripts/util.sh +++ b/src/scripts/util.sh @@ -91,3 +91,22 @@ is_renewal_required() { is_finshed_week_sec=$(( ($one_week_sec - $last_renewal_delta_sec) )) [ $is_finshed_week_sec -lt 0 ] } + +# symlinks any *.conf files in /etc/nginx/user.conf.d +# to /etc/nginx/conf.d so they are included as configs +# this allows a user to easily mount their own configs +link_user_configs() { + SOURCE_DIR=${1-/etc/nginx/user.conf.d} + TARGET_DIR=${2-/etc/nginx/conf.d} + + echo "symlinking scripts from ${SOURCE_DIR} to ${TARGET_DIR}" + + if [ ! -d "$SOURCE_DIR" ]; then + echo "no ${SOURCE_DIR}, nothing to do." + else + for conf in ${SOURCE_DIR}/*.conf; do + echo "symlinking: ${conf}" "${TARGET_DIR}/$(basename ${conf})" + ln -s "${conf}" "${TARGET_DIR}/$(basename ${conf})" + done + fi +} \ No newline at end of file