mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:06:06 +00:00
fix: By USE_STATIC_SERVER environment to determine whether to start the static server
This commit is contained in:
parent
4b3d07d51c
commit
6c4a73f260
@ -19,3 +19,4 @@ HTTP_PORT=23000
|
||||
VERDACCIO_PORT=4873
|
||||
|
||||
LOCAL_STORAGE_BASE_URL=http://localhost:23000/uploads
|
||||
USE_STATIC_SERVER=true
|
||||
|
@ -16,3 +16,4 @@ HTTP_PORT=23000
|
||||
VERDACCIO_PORT=4873
|
||||
|
||||
LOCAL_STORAGE_BASE_URL=http://localhost:23000/uploads
|
||||
USE_STATIC_SERVER=true
|
||||
|
@ -54,10 +54,7 @@ export function middleware(app) {
|
||||
// 否则都忽略,交给其他 server 来提供(如 nginx/cdn 等)
|
||||
// TODO(bug): https、端口 80 默认值和其他本地 ip/hostname 的情况未考虑
|
||||
// TODO 实际应该用 NOCOBASE_ENV 来判断,或者抛给 env 处理
|
||||
if (url.protocol === 'http:'
|
||||
&& url.hostname === 'localhost'
|
||||
&& url.port === process.env.HTTP_PORT
|
||||
) {
|
||||
if (process.env.USE_STATIC_SERVER) {
|
||||
const basePath = url.pathname.startsWith('/') ? url.pathname : `/${url.pathname}`;
|
||||
app.use(mount(basePath, serve(getDocumentRoot(storage))));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user