Improve how Redis is handled for nginx

This commit is contained in:
Buster "Silver Eagle" Neece 2022-03-16 02:02:45 -05:00
parent 2bfc1e9d19
commit 7524896a4b
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
2 changed files with 7 additions and 17 deletions

View File

@ -1,4 +1,4 @@
{{if isTrue .Env.ENABLE_REDIS }}
{{if isTrue .Env.REDIS_LOCAL }}
upstream redis_server {
nchan_redis_server "redis://localhost:6379";
}
@ -9,7 +9,7 @@ server {
location ~ /pub/([^\/]+)$ {
nchan_publisher;
{{if isTrue .Env.ENABLE_REDIS}}
{{if isTrue .Env.REDIS_LOCAL}}
nchan_redis_pass redis_server;
{{end}}
@ -148,7 +148,7 @@ server {
nchan_access_control_allow_origin "*";
nchan_subscriber;
{{if isTrue .Env.ENABLE_REDIS}}
{{if isTrue .Env.REDIS_LOCAL}}
nchan_redis_pass redis_server;
{{end}}

View File

@ -2,21 +2,11 @@
sv -w 30 check php-fpm || exit 1
bool() {
case "$1" in
Y* | y* | true | TRUE | 1) return 0 ;;
esac
return 1
}
ENABLE_REDIS=${ENABLE_REDIS:-false}
if bool "$ENABLE_REDIS"; then
ENABLE_REDIS=true
else
ENABLE_REDIS=false
REDIS_LOCAL=false
if [ -f /etc/service/redis/run ]; then
REDIS_LOCAL=true
fi
export ENABLE_REDIS
export REDIS_LOCAL
# Copy the nginx template to its destination.
dockerize -template "/etc/nginx/nginx.conf.tmpl:/etc/nginx/nginx.conf" \