mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
a16d76d25d
Summary: The name of this env var has bothered me for a little while. Let's rename it more meaningfully. Test Plan: No need to test, cosmetic change only. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4320
33 lines
1018 B
TypeScript
33 lines
1018 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.GRIST_FORCE_ENABLE_ENTERPRISE) ? "enterprise" : "core",
|
|
fileConfigValue("edition")
|
|
)
|
|
};
|
|
}
|