diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 44b8c56..b670073 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,8 +1,4 @@ #!/bin/bash set -e - -# 使用envsubst命令替换nginx.conf.template文件中的环境变量 -envsubst '$API_BASE_URL $API_DRAWIO_URL $API_OFFICE_URL' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf - -# 启动Nginx +envsubst < /var/www/public/config.js > /var/www/public/config.js exec "$@" diff --git a/public/config.js b/public/config.js new file mode 100644 index 0000000..64157ba --- /dev/null +++ b/public/config.js @@ -0,0 +1,4 @@ +window._env_ = { + API_URL: "", + API_OFFICE_URL: "", +}; diff --git a/public/index.html b/public/index.html index 4dfaa70..23a8500 100644 --- a/public/index.html +++ b/public/index.html @@ -35,7 +35,7 @@ <%= webpackConfig.name %> - +