feat(core): separate runtimeConfig for e2e tests and deployment (#5976)

Prior to modification, it will function for both `deploy` and `e2e-test`. Consequently, `allowLocalWorkspace` is also set to `true` in the production environment.
https://github.com/toeverything/AFFiNE/actions/runs/8093473180/job/22116199541#step:5:120
This commit is contained in:
JimmFly
2024-03-03 12:00:10 +00:00
parent a1ea19fcb7
commit ffda9a0567
2 changed files with 11 additions and 1 deletions

View File

@@ -147,6 +147,10 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
: currentBuildPreset.allowLocalWorkspace,
};
const testEnvironmentPreset = {
allowLocalWorkspace: true,
};
if (buildFlags.mode === 'development') {
currentBuildPreset.serverUrlPrefix = 'http://localhost:8080';
}
@@ -156,6 +160,10 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
// environment preset will overwrite current build preset
// this environment variable is for debug proposes only
// do not put them into CI
...(process.env.CI ? { allowLocalWorkspace: true } : environmentPreset),
...(process.env.CI ? {} : environmentPreset),
// test environment preset will overwrite current build preset
// this environment variable is for github workflow e2e-test only
...(process.env.IN_CI_TEST ? testEnvironmentPreset : {}),
};
}