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

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