修改环境配置,根据配置自动选中后端地址,不需要再手动更改
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
const baseWebConfig ={
|
||||
baseUrl: 'http://localhost:8080',
|
||||
//baseUrl: 'http://43.138.83.20:10001',
|
||||
timeout: 10000,
|
||||
}
|
||||
|
||||
export default baseWebConfig;
|
||||
// baseWebConfig.js
|
||||
const baseWebConfig = {
|
||||
// 从环境变量读取baseUrl(本地开发用localhost,build用ip:10001)
|
||||
baseUrl: process.env.REACT_APP_BACKEND_ADDRESS,
|
||||
// 读取超时时间(转成数字类型)
|
||||
timeout: Number(process.env.REACT_APP_BACKEND_TIMEOUT)
|
||||
};
|
||||
console.log('当前环境 baseUrl:', baseWebConfig.baseUrl);
|
||||
console.log('当前超时时间:', baseWebConfig.timeout);
|
||||
export default baseWebConfig;
|
||||
Reference in New Issue
Block a user