mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
d57c3f068d
This will ensure that the grist-ee image will have a consistent config setting when created from the default value.
33 lines
1011 B
TypeScript
33 lines
1011 B
TypeScript
import {
|
|
createConfigValue,
|
|
FileConfig,
|
|
fileConfigAccessorFactory,
|
|
IWritableConfigValue
|
|
} from "./config";
|
|
import {convertToCoreFileContents, IGristCoreConfigFileLatest} from "./configCoreFileFormats";
|
|
import {isAffirmative} from 'app/common/gutil';
|
|
|
|
export type Edition = "core" | "enterprise";
|
|
|
|
/**
|
|
* Config options for Grist Core.
|
|
*/
|
|
export interface IGristCoreConfig {
|
|
edition: IWritableConfigValue<Edition>;
|
|
}
|
|
|
|
export function loadGristCoreConfigFile(configPath?: string): IGristCoreConfig {
|
|
const fileConfig = configPath ? FileConfig.create(configPath, convertToCoreFileContents) : undefined;
|
|
return loadGristCoreConfig(fileConfig);
|
|
}
|
|
|
|
export function loadGristCoreConfig(fileConfig?: FileConfig<IGristCoreConfigFileLatest>): IGristCoreConfig {
|
|
const fileConfigValue = fileConfigAccessorFactory(fileConfig);
|
|
return {
|
|
edition: createConfigValue<Edition>(
|
|
isAffirmative(process.env.TEST_ENABLE_ACTIVATION) ? "enterprise" : "core",
|
|
fileConfigValue("edition")
|
|
)
|
|
};
|
|
}
|