Improve how Redis is handled for nginx
This commit is contained in:
parent
2bfc1e9d19
commit
7524896a4b
|
@ -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}}
|
||||
|
||||
|
|
|
@ -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" \
|
||||
|
|
Loading…
Reference in New Issue