0213d8c6d6
Add config/config.yaml to set default configurations. Use the config/local_config.yaml to set the custom configurations Change-Id: I22049e478b6440c765751c8f17663f36f33c277a
32 lines
695 B
JavaScript
32 lines
695 B
JavaScript
const { isObject } = require('lodash');
|
|
const { getServerConfig } = require('./utils');
|
|
|
|
const { server, port, host } = getServerConfig();
|
|
|
|
const getProxyByMap = (apiMap) => {
|
|
const result = {};
|
|
Object.keys(apiMap).forEach((key) => {
|
|
const value = apiMap[key];
|
|
const base = isObject(value) ? value : { target: value };
|
|
result[key] = {
|
|
...base,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
headers: {
|
|
Connection: 'keep-alive',
|
|
},
|
|
};
|
|
});
|
|
return result;
|
|
};
|
|
|
|
const apiMap = {
|
|
'/api/': server,
|
|
};
|
|
|
|
// eslint-disable-next-line no-console
|
|
console.log('apiMap', apiMap);
|
|
const proxy = getProxyByMap(apiMap);
|
|
|
|
module.exports = { proxy, host, port };
|