feat(服务器): 修改服务器自动开服策略

This commit is contained in:
luying
2023-04-25 13:04:30 +08:00
parent af1f6b9d8c
commit 906449be60
14 changed files with 121 additions and 128 deletions

View File

@@ -23,25 +23,6 @@ export default (appInfo: EggAppInfo) => {
pw: ''
};
let regions = [ // 大区数据
{ id: 1, env: 'development', name: "测试", domain: 'http://127.0.0.1:9000' },
];
config.regions = regions;
let httpProxy: any = {};
for(let { env, domain } of regions) {
httpProxy[`/api/${env}/`] = {
target: domain,
changeOrigin: true,
secure: true,
pathRewrite: function(path) {
console.log('proxy', path, path.replace(`/api/${env}/`, '/api/'))
return path.replace(`/api/${env}/`, '/api/')
}
}
}
config.proxy = httpProxy;
// the return config will combines to EggAppConfig
return {
...defaultConfig(appInfo),