xiaoWangSec
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
3 additions and
3 deletions
-
internal/vite-config/src/plugins/appConfig.ts
-
src/hooks/setting/index.ts
-
src/utils/env.ts
|
|
|
@ -28,7 +28,7 @@ async function createAppConfigPlugin({ |
|
|
|
name: PLUGIN_NAME, |
|
|
|
async configResolved(_config) { |
|
|
|
let appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? ''; |
|
|
|
appTitle = appTitle.replace(/\s/g, '_'); |
|
|
|
appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_'); |
|
|
|
publicPath = _config.base; |
|
|
|
source = await getConfigSource(appTitle); |
|
|
|
}, |
|
|
|
|
|
|
|
@ -10,7 +10,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => { |
|
|
|
const glob: Readonly<GlobConfig> = { |
|
|
|
title: VITE_GLOB_APP_TITLE, |
|
|
|
apiUrl: VITE_GLOB_API_URL, |
|
|
|
shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_'), |
|
|
|
shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_').replace(/-/g, '_'), |
|
|
|
urlPrefix: VITE_GLOB_API_URL_PREFIX, |
|
|
|
uploadUrl: VITE_GLOB_UPLOAD_URL, |
|
|
|
}; |
|
|
|
|
|
|
|
@ -2,7 +2,7 @@ import type { GlobEnvConfig } from '/#/config'; |
|
|
|
import pkg from '../../package.json'; |
|
|
|
|
|
|
|
const getVariableName = (title: string) => { |
|
|
|
return `__PRODUCTION__${title.replace(/\s/g, '_') || '__APP'}__CONF__` |
|
|
|
return `__PRODUCTION__${title.replace(/\s/g, '_').replace(/-/g, '_') || '__APP'}__CONF__` |
|
|
|
.toUpperCase() |
|
|
|
.replace(/\s/g, ''); |
|
|
|
}; |
|
|
|
|