fix: 修复 Docker 部署 API 地址与数据库连接问题
This commit is contained in:
@@ -27,26 +27,8 @@ const authIdleTimeoutMs =
|
||||
? authIdleTimeoutMinutes * 60 * 1000
|
||||
: 30 * 60 * 1000
|
||||
|
||||
function resolveBrowserApiBaseUrl(state) {
|
||||
const server = state?.server || {}
|
||||
const configuredHost = String(server.host || '127.0.0.1').trim()
|
||||
const port = Number(server.port || 8000)
|
||||
const apiPrefix = String(import.meta.env.VITE_API_BASE_PREFIX || '/api/v1').replace(/\/$/, '') || '/api/v1'
|
||||
|
||||
if (typeof window === 'undefined') {
|
||||
return `http://${configuredHost}:${port}${apiPrefix}`
|
||||
}
|
||||
|
||||
const browserHost = window.location.hostname
|
||||
const normalizedHost = configuredHost.toLowerCase()
|
||||
const host =
|
||||
normalizedHost === '0.0.0.0' ||
|
||||
normalizedHost === '::' ||
|
||||
(normalizedHost === '127.0.0.1' && browserHost && browserHost !== '127.0.0.1' && browserHost !== 'localhost')
|
||||
? browserHost
|
||||
: configuredHost
|
||||
|
||||
return `http://${host}:${port}${apiPrefix}`
|
||||
function resolveBrowserApiBaseUrl() {
|
||||
return '/api/v1'
|
||||
}
|
||||
|
||||
let sessionRouter = null
|
||||
|
||||
Reference in New Issue
Block a user