mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
Merge 45ae29f4c3
into 51db59622c
This commit is contained in:
commit
0278229b28
|
@ -857,6 +857,12 @@ NGINX_PROXY_SEND_TIMEOUT=3600s
|
||||||
# Set true to accept requests for /.well-known/acme-challenge/
|
# Set true to accept requests for /.well-known/acme-challenge/
|
||||||
NGINX_ENABLE_CERTBOT_CHALLENGE=false
|
NGINX_ENABLE_CERTBOT_CHALLENGE=false
|
||||||
|
|
||||||
|
# chatbot baisc auth
|
||||||
|
# If you set the value of NGINX_CHATBOT_BASIC_AUTH_ENABLED to true, please also modify the values of NGINX_CHATBOT_BASIC_AUTH_USER and NGINX_CHATBOT_BASIC_AUTH_PASSWORD.
|
||||||
|
NGINX_CHATBOT_BASIC_AUTH_ENABLED=false
|
||||||
|
NGINX_CHATBOT_BASIC_AUTH_USER=dify
|
||||||
|
NGINX_CHATBOT_BASIC_AUTH_PASSWORD=difyaipwd
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# Certbot Configuration
|
# Certbot Configuration
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|
|
@ -473,6 +473,9 @@ services:
|
||||||
NGINX_PROXY_SEND_TIMEOUT: ${NGINX_PROXY_SEND_TIMEOUT:-3600s}
|
NGINX_PROXY_SEND_TIMEOUT: ${NGINX_PROXY_SEND_TIMEOUT:-3600s}
|
||||||
NGINX_ENABLE_CERTBOT_CHALLENGE: ${NGINX_ENABLE_CERTBOT_CHALLENGE:-false}
|
NGINX_ENABLE_CERTBOT_CHALLENGE: ${NGINX_ENABLE_CERTBOT_CHALLENGE:-false}
|
||||||
CERTBOT_DOMAIN: ${CERTBOT_DOMAIN:-}
|
CERTBOT_DOMAIN: ${CERTBOT_DOMAIN:-}
|
||||||
|
NGINX_CHATBOT_BASIC_AUTH_ENABLED: ${NGINX_CHATBOT_BASIC_AUTH_ENABLED:-false}}
|
||||||
|
NGINX_CHATBOT_BASIC_AUTH_USER: ${NGINX_CHATBOT_BASIC_AUTH_USER:-dify}
|
||||||
|
NGINX_CHATBOT_BASIC_AUTH_PASSWORD: ${NGINX_CHATBOT_BASIC_AUTH_PASSWORD:-difyaipwd}
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- api
|
||||||
- web
|
- web
|
||||||
|
|
3
docker/nginx/conf.d/.gitignore
vendored
Normal file
3
docker/nginx/conf.d/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
.htpasswd
|
||||||
|
default.conf
|
|
@ -24,6 +24,9 @@ server {
|
||||||
include proxy.conf;
|
include proxy.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# placeholder for chatbot basic auth
|
||||||
|
${CHATBOT_BASIC_AUTH_CONFIG}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://web:3000;
|
proxy_pass http://web:3000;
|
||||||
include proxy.conf;
|
include proxy.conf;
|
||||||
|
|
|
@ -28,6 +28,31 @@ else
|
||||||
fi
|
fi
|
||||||
export ACME_CHALLENGE_LOCATION
|
export ACME_CHALLENGE_LOCATION
|
||||||
|
|
||||||
|
if [ "${NGINX_CHATBOT_BASIC_AUTH_ENABLED}" = "true" ]; then
|
||||||
|
# install apache2-utils to get htpasswd
|
||||||
|
if command -v htpasswd >/dev/null 2>&1; then
|
||||||
|
echo "htpasswd is installed."
|
||||||
|
else
|
||||||
|
echo "htpasswd is not installed."
|
||||||
|
apt update
|
||||||
|
apt install -y apache2-utils
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create htpassword file for basic auth
|
||||||
|
htpasswd -bc /etc/nginx/conf.d/.htpasswd "${NGINX_CHATBOT_BASIC_AUTH_USER}" "${NGINX_CHATBOT_BASIC_AUTH_PASSWORD}"
|
||||||
|
|
||||||
|
CHATBOT_BASIC_AUTH_CONFIG='location /chat {
|
||||||
|
auth_basic "Restricted";
|
||||||
|
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
|
||||||
|
proxy_pass http://web:3000;
|
||||||
|
include proxy.conf;
|
||||||
|
}
|
||||||
|
'
|
||||||
|
else
|
||||||
|
CHATBOT_BASIC_AUTH_CONFIG=''
|
||||||
|
fi
|
||||||
|
export CHATBOT_BASIC_AUTH_CONFIG
|
||||||
|
|
||||||
env_vars=$(printenv | cut -d= -f1 | sed 's/^/$/g' | paste -sd, -)
|
env_vars=$(printenv | cut -d= -f1 | sed 's/^/$/g' | paste -sd, -)
|
||||||
|
|
||||||
envsubst "$env_vars" < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
envsubst "$env_vars" < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||||
|
|
Loading…
Reference in New Issue
Block a user