You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB
TypeScript

12 months ago
/** 请求服务的环境配置 */
type ServiceEnv = Record<ServiceEnvType, ServiceEnvConfig>;
/** 不同请求服务的环境配置 */
export const serviceEnv: ServiceEnv = {
dev: {
// url: 'http://huaerda-api.24yt.com',
url: 'http://106.227.80.14:8086',
12 months ago
// url: 'http://127.0.0.1:8080/',
// url: 'http://192.168.9.89:8080',
// url: 'http://192.168.20.80:8080',
// url: 'http://192.168.110.65:8080',
kkFileUrl: 'http://192.168.9.68:8012',
reportServerUrl: 'http://192.168.9.128:9908'
// reportServerUrl: 'http://huaerda-jimu.24yt.com/'6
},
test: {
12 months ago
url: 'http://106.227.80.14:8086/',
12 months ago
// url: 'http://192.168.9.128:8080'
kkFileUrl: 'http://192.168.9.68:8012',
// reportServerUrl: 'http://192.168.9.128:9908'
reportServerUrl: 'http://huaerda-jimu.24yt.com/'
},
prod: {
// url: 'http://192.168.9.149:8021'
// url: 'http://huaerda-api.24yt.com',
url: 'http://106.227.80.14:8086',
12 months ago
kkFileUrl: 'http://kkfile.24yt.com',
// reportServerUrl: 'http://localhost:9908'
reportServerUrl: 'http://huaerda-jimu.24yt.com/'
}
};
if (typeof window !== 'undefined') {
const protocol = window.location.protocol;
if (protocol === 'https:') {
// serviceEnv.dev.url = 'https://192.168.9.237:8182';
serviceEnv.dev.url = 'http://106.227.80.14:8088/';
serviceEnv.test.url = 'http://106.227.80.14:8088/';
// serviceEnv.prod.url = 'https://huaerda-api.24yt.com';
serviceEnv.prod.url = 'http://106.227.80.14:8088/';
serviceEnv.prod.reportServerUrl = 'https://huaerda-jimu.24yt.com/';
}
}
/**
*
* @param env
*/
export function getServiceEnvConfig(env: ImportMetaEnv): ServiceEnvConfigWithProxyPattern {
const { VITE_SERVICE_ENV = 'dev' } = env;
const config = serviceEnv[VITE_SERVICE_ENV];
return {
...config,
proxyPattern: '/api'
};
}