diff --git a/src/usr/local/bin/entrypoint.sh b/src/usr/local/bin/entrypoint.sh index b664e6e..31b0645 100644 --- a/src/usr/local/bin/entrypoint.sh +++ b/src/usr/local/bin/entrypoint.sh @@ -1,33 +1,12 @@ #!/bin/bash set -ex; -## Defaults ## -CA_URL=${CA_URL:-none}; -REWRITE_TYPE=${REWRITE_TYPE:-none}; -REWRITE_EXCLUDE=${REWRITE_EXCLUDE:-none}; - -if [ "${CA_URL}" != "none" ];then - /usr/local/bin/cert-updater -p "${CA_URL}"; -else - echo "CA Certificates: Nothing to import, CA_URL is not defined"; -fi - -if [ "${REWRITE_TYPE}" != "none" ];then - echo "Apache Config: REWRITE_TYPE is defined, attempting to add rewrite config to enabled site" - FILE="/usr/local/share/apache2/${REWRITE_TYPE,,}.rewrite" - if [ -f $FILE ];then - sed -i -e "/#REWRITE/{r$FILE" -e "d}" /etc/apache2/sites-enabled/default-ssl.conf - echo "Apache Config: Using rewrite template ${FILE}"; - if [ "${REWRITE_EXCLUDE}" != "none" ];then - echo "Apache Config: REWRITE_EXCLUDE is defined, setting rewrite to ignore the matched pattern ${REWRITE_EXCLUDE}" - sed -i "s@#REWRITE_EXCLUDE@a$(printf %q " RewriteRule ${REWRITE_EXCLUDE} - [L]")@g" /etc/apache2/sites-enabled/default-ssl.conf - fi - fi -else - echo "Apache Config: Using default site without rewrite, REWRITE is not defined" +## Certificates ## +if [ "${CERT_PATH}" != "" ];then + /usr/local/bin/cert-updater; fi -exec "$@" -echo "Initialization complete, container ready" +## Initialization ## +/usr/local/bin/app-config; apachectl -k start -D FOREGROUND diff --git a/src/usr/local/share/apache2/api.rewrite b/src/usr/local/share/apache2/api.rewrite deleted file mode 100644 index 6ddddca..0000000 --- a/src/usr/local/share/apache2/api.rewrite +++ /dev/null @@ -1,13 +0,0 @@ - RewriteEngine On - #Exclude Acme - RewriteRule ^(\/\.well\-known\/acme\-challenge.*) - [L] - #Exclude User Defined - #REWRITE_EXCLUDE - #Forward/Set the Authorization Header for Basic/Bearer - RewriteCond %{HTTP:Authorization} ^(.*) - RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] - RewriteCond %{REMOTE_USER} ^(.*) - RewriteRule .* - [e=REMOTE_USER:%1] - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ /index.php/$1 [L,QSA] diff --git a/src/usr/local/share/apache2/php.rewrite b/src/usr/local/share/apache2/php.rewrite deleted file mode 100644 index 3dcb4e4..0000000 --- a/src/usr/local/share/apache2/php.rewrite +++ /dev/null @@ -1,11 +0,0 @@ - RewriteEngine On - #Exclude Acme - RewriteRule ^(\/\.well\-known\/acme\-challenge.*) - [L] - #Exclude User Defined - #REWRITE_EXCLUDE - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.+)\/$ $1 [NE,R=301,L,QSA] - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}\.php -f - RewriteRule ^(.*)$ $1.php [L]