2024-07-08 14:40:45 +00:00
|
|
|
import {
|
|
|
|
createConfigValue,
|
|
|
|
FileConfig,
|
|
|
|
fileConfigAccessorFactory,
|
|
|
|
IWritableConfigValue
|
|
|
|
} from "./config";
|
|
|
|
import { convertToCoreFileContents, IGristCoreConfigFileLatest } from "./configCoreFileFormats";
|
|
|
|
|
|
|
|
export type Edition = "core" | "enterprise";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Config options for Grist Core.
|
|
|
|
*/
|
|
|
|
export interface IGristCoreConfig {
|
|
|
|
edition: IWritableConfigValue<Edition>;
|
|
|
|
}
|
|
|
|
|
2024-07-17 21:46:28 +00:00
|
|
|
export function loadGristCoreConfigFile(configPath?: string): IGristCoreConfig {
|
|
|
|
const fileConfig = configPath ? FileConfig.create(configPath, convertToCoreFileContents) : undefined;
|
2024-07-08 14:40:45 +00:00
|
|
|
return loadGristCoreConfig(fileConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function loadGristCoreConfig(fileConfig?: FileConfig<IGristCoreConfigFileLatest>): IGristCoreConfig {
|
|
|
|
const fileConfigValue = fileConfigAccessorFactory(fileConfig);
|
|
|
|
return {
|
|
|
|
edition: createConfigValue<Edition>("core", fileConfigValue("edition"))
|
|
|
|
};
|
|
|
|
}
|