22 lines
824 B
JavaScript
22 lines
824 B
JavaScript
const configuredBaseUrl = 'https://backend-api.ddxcjp.cn'
|
|
const configuredClientId = '428a8310cd442757ae699df5d894f051'
|
|
const configuredTenantId = '000000'
|
|
|
|
if (!/^https:\/\/[^\s/]+(?:\/[^\s]*)?$/.test(configuredBaseUrl)) {
|
|
throw new Error('正式服务地址必须使用 HTTPS')
|
|
}
|
|
if (configuredBaseUrl.endsWith('/')) {
|
|
throw new Error('VITE_JIAPU_API_BASE_URL 不能以斜杠结尾')
|
|
}
|
|
if (!configuredClientId || !configuredTenantId) {
|
|
throw new Error('远程服务的 clientId 和 tenantId 不能为空')
|
|
}
|
|
|
|
// 业务模块只消费这一份不可变正式配置;测试替身在 API 服务边界注入,
|
|
// 不通过构建机环境变量改变正式包的服务端点。
|
|
export const runtimeConfig = Object.freeze({
|
|
baseUrl: configuredBaseUrl,
|
|
clientId: configuredClientId,
|
|
tenantId: configuredTenantId
|
|
})
|