chore: remove local fe config

pull/56/head
moonrailgun 3 years ago
parent 41a83a0938
commit cbaa872a29

@ -1,3 +0,0 @@
{
"serviceUrl": null
}

@ -76,10 +76,6 @@ const plugins: Configuration['plugins'] = [
from: path.resolve(ROOT_PATH, './assets/pwa.webmanifest'),
to: 'pwa.webmanifest',
},
{
from: path.resolve(ROOT_PATH, './assets/config.json'),
to: 'config.json',
},
{
from: path.resolve(ROOT_PATH, './assets/images/logo/'),
to: 'images/logo/',
@ -103,7 +99,7 @@ const plugins: Configuration['plugins'] = [
skipWaiting: true,
// Do not precache images
exclude: [/\.(?:png|jpg|jpeg|svg)$/, 'config.json'],
exclude: [/\.(?:png|jpg|jpeg|svg)$/],
maximumFileSizeToCacheInBytes: 8 * 1024 * 1024, // 限制最大缓存 8M

@ -1,20 +0,0 @@
/**
* 用于 dockerfile 启动命令
* 将环境变量的信息同步到 dist/config.json 文件中
*/
const fs = require('fs-extra');
const path = require('path');
const envConfig = require('../assets/config.json'); // 获取默认配置
if (process.env.SERVICE_URL) {
envConfig.serviceUrl = process.env.SERVICE_URL;
}
if (envConfig) {
fs.writeJsonSync(path.resolve(__dirname, '../dist/config.json'), envConfig, {
spaces: 2,
});
console.log('从环境变量更新config完毕:', envConfig);
}

@ -107,24 +107,7 @@ setErrorHook((err) => {
/**
*
*/
request
.get('/config.json?v2', {
baseURL: '',
})
.then(({ data: config }) => {
if (!localStorageServiceUrl && isValidStr(_get(config, 'serviceUrl'))) {
// 配置的优先级低于localStorage的优先级
setServiceUrl(() => _get(config, 'serviceUrl'));
}
})
.catch(() => {})
.finally(() => {
/**
*
* ()
*/
fetchGlobalConfig().catch((e) => {
fetchGlobalConfig().catch((e) => {
showErrorToasts(t('全局配置加载失败'));
console.error('全局配置加载失败', e);
});
});
});

Loading…
Cancel
Save