feat: 支持运行时动态配置文件大小限制
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 生成运行时配置文件,注入环境变量到前端
|
||||
cat > /usr/share/nginx/html/config.js << EOF
|
||||
window.__RUNTIME_CONFIG__ = {
|
||||
MAX_FILE_SIZE_MB: ${MAX_FILE_SIZE_MB:-50}
|
||||
};
|
||||
EOF
|
||||
|
||||
# 处理 nginx 配置
|
||||
export MAX_FILE_SIZE=${MAX_FILE_SIZE_MB}M
|
||||
envsubst '${MAX_FILE_SIZE}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 启动 nginx
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user