mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(core): avoid expand runtime config everywhere used (#7972)
This commit is contained in:
14
packages/common/env/src/global.ts
vendored
14
packages/common/env/src/global.ts
vendored
@@ -87,11 +87,23 @@ interface Desktop extends ChromeBrowser {
|
||||
|
||||
export type Environment = Browser | Server | Desktop;
|
||||
|
||||
function setupRuntimeConfig() {
|
||||
if (!process.env.RUNTIME_CONFIG) {
|
||||
return;
|
||||
}
|
||||
|
||||
// registered by [webpack.DefinePlugin]
|
||||
const runtimeConfig = JSON.parse(process.env.RUNTIME_CONFIG ?? '');
|
||||
runtimeFlagsSchema.parse(runtimeConfig);
|
||||
globalThis.runtimeConfig = runtimeConfig;
|
||||
}
|
||||
|
||||
export function setupGlobal() {
|
||||
if (globalThis.$AFFINE_SETUP) {
|
||||
return;
|
||||
}
|
||||
runtimeFlagsSchema.parse(runtimeConfig);
|
||||
|
||||
setupRuntimeConfig();
|
||||
|
||||
let environment: Environment;
|
||||
const isDebug = process.env.NODE_ENV === 'development';
|
||||
|
||||
Reference in New Issue
Block a user