configCore: default to enterprise edition if TEST_ENABLE_ACTIVATION is truthy

This will ensure that the grist-ee image will have a consistent config
setting when created from the default value.
This commit is contained in:
Jordi Gutiérrez Hermoso 2024-07-22 09:45:12 -04:00 committed by jordigh
parent f0aacc4d96
commit d57c3f068d

View File

@ -5,6 +5,7 @@ import {
IWritableConfigValue
} from "./config";
import {convertToCoreFileContents, IGristCoreConfigFileLatest} from "./configCoreFileFormats";
import {isAffirmative} from 'app/common/gutil';
export type Edition = "core" | "enterprise";
@ -23,6 +24,9 @@ export function loadGristCoreConfigFile(configPath?: string): IGristCoreConfig {
export function loadGristCoreConfig(fileConfig?: FileConfig<IGristCoreConfigFileLatest>): IGristCoreConfig {
const fileConfigValue = fileConfigAccessorFactory(fileConfig);
return {
edition: createConfigValue<Edition>("core", fileConfigValue("edition"))
edition: createConfigValue<Edition>(
isAffirmative(process.env.TEST_ENABLE_ACTIVATION) ? "enterprise" : "core",
fileConfigValue("edition")
)
};
}