2026-08-25 00:24:57 +08:00
|
|
|
const runtimeEnvironment = import.meta.env || {}
|
2026-09-29 17:56:05 +08:00
|
|
|
const configuredApiRoot = runtimeEnvironment.VITE_API_BASE_URL || ''
|
2026-08-25 19:56:47 +08:00
|
|
|
const development = Boolean(runtimeEnvironment.DEV)
|
2026-09-29 17:56:05 +08:00
|
|
|
let selectedApiRoot = configuredApiRoot || '/api'
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
selectedApiRoot = runtimeEnvironment.VITE_H5_API_BASE_URL || '/api'
|
|
|
|
|
// #endif
|
2026-08-26 15:59:08 +08:00
|
|
|
const nativeRuntime = typeof plus !== 'undefined'
|
|
|
|
|
|| (typeof location !== 'undefined' && location.protocol === 'file:')
|
2026-09-29 17:56:05 +08:00
|
|
|
if (nativeRuntime) selectedApiRoot = configuredApiRoot || ''
|
|
|
|
|
export const API_ROOT = String(selectedApiRoot).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 || '') : ''
|
|
|
|
|
})
|