1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-20 18:12:31 +01:00

feat: Adds TP_URLBASE env

This commit is contained in:
GilbN 2022-03-29 21:33:17 +02:00
parent a8f4606442
commit 9b2d43722d
2 changed files with 34 additions and 6 deletions

View File

@ -9,17 +9,23 @@ server {
ssl_certificate /config/keys/cert.crt;
ssl_certificate_key /config/keys/cert.key;
root /config/www;
index index.html index.htm index.php;
#location#/ {return 302 $scheme://TP_DOMAIN/TP_URLBASE$request_uri;}
location / {
alias /config/www/;
sub_filter_types *;
sub_filter 'https://theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'http://theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'https://develop.theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'http://develop.theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'https://theme-park.dev/' $scheme://TP_DOMAIN/TP_URLBASE/;
sub_filter 'http://theme-park.dev/' $scheme://TP_DOMAIN/TP_URLBASE/;
sub_filter 'https://develop.theme-park.dev/' $scheme://TP_DOMAIN/TP_URLBASE/;
sub_filter 'http://develop.theme-park.dev/' $scheme://TP_DOMAIN/TP_URLBASE/;
sub_filter_once off;
try_files $uri $uri/ /index.html;
#SUBFOLDER SUBFILTERS
#sub_filter 'https://TP_DOMAIN' $scheme://TP_DOMAIN/TP_URLBASE;
#sub_filter 'http://TP_DOMAIN' $scheme://TP_DOMAIN/TP_URLBASE;
}
# Don't cache

View File

@ -10,6 +10,7 @@ PUID=${PUID}\\n\
PGID=${PGID}\\n\
TZ=${TZ}\\n\
TP_SCHEME=${TP_SCHEME}\\n\
TP_URLBASE=${TP_URLBASE}\\n\
TP_DOMAIN=${TP_DOMAIN}\\n"
if [[ -z ${TP_DOMAIN} ]]; then
@ -22,8 +23,29 @@ if [[ -z ${TP_SCHEME} ]]; then
TP_SCHEME='https'
fi
if [[ -z ${TP_URLBASE} ]]; then
TP_URLBASE=''
fi
# Remove forward slash
case ${TP_URLBASE} in
*"/"*)
TP_URLBASE=$(echo "${TP_URLBASE}" | sed 's/\///g')
;;
esac
DEFAULT='/defaults/default'
sed -i "s/TP_DOMAIN/${TP_DOMAIN} /g" ${DEFAULT}
if [[ ${TP_URLBASE} ]]; then
echo "seding location"
sed -i "s/location \//location \/${TP_URLBASE}/g" ${DEFAULT}
echo "seding TP_DOMAIN"
sed -i "s/TP_DOMAIN/${TP_DOMAIN}/g" ${DEFAULT}
sed -i "s/TP_URLBASE/${TP_URLBASE}/g" ${DEFAULT}
sed -i "s/#sub_filter/sub_filter/g" ${DEFAULT}
sed -i "s/#location#/location /g" ${DEFAULT}
elif [[ -z ${TP_URLBASE} ]]; then
sed -i "s/TP_DOMAIN\/TP_URLBASE/${TP_DOMAIN}/g" ${DEFAULT}
fi
cp /defaults/default /config/nginx/site-confs
# make our folders and links