2026-08-25 00:24:57 +08:00
|
|
|
const runtimeEnvironment = import.meta.env || {}
|
|
|
|
|
const configuredAuthApiRoot = runtimeEnvironment.VITE_AUTH_API_BASE_URL || ''
|
|
|
|
|
const configuredOverseasApiRoot = runtimeEnvironment.VITE_OVERSEAS_API_BASE_URL || ''
|
2026-08-25 19:56:47 +08:00
|
|
|
const development = Boolean(runtimeEnvironment.DEV)
|
2026-08-20 20:10:20 +08:00
|
|
|
|
2026-08-26 15:24:51 +08:00
|
|
|
let selectedAuthApiRoot = configuredAuthApiRoot || '/api'
|
|
|
|
|
let selectedOverseasApiRoot = configuredOverseasApiRoot || '/overseas-api'
|
|
|
|
|
|
|
|
|
|
// H5 must stay same-origin and use Vite's CORS-safe proxy; App builds keep the absolute API roots above.
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
selectedAuthApiRoot = runtimeEnvironment.VITE_H5_AUTH_API_BASE_URL || '/api'
|
|
|
|
|
selectedOverseasApiRoot = runtimeEnvironment.VITE_H5_OVERSEAS_API_BASE_URL || '/overseas-api'
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
export const API_ROOT = String(selectedAuthApiRoot).replace(/\/$/, '')
|
|
|
|
|
export const OVERSEAS_API_ROOT = String(selectedOverseasApiRoot).replace(/\/$/, '')
|
2026-08-25 19:56:47 +08:00
|
|
|
export const DEV_LOGIN = Object.freeze({
|
|
|
|
|
username: development ? String(runtimeEnvironment.VITE_PDA_DEV_USERNAME || '') : '',
|
|
|
|
|
password: development ? String(runtimeEnvironment.VITE_PDA_DEV_PASSWORD || '') : ''
|
|
|
|
|
})
|