mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
e30a090a4e
Now that reading is synchronous, there's no need to have any more async/await in regards to the those config functions.
20 lines
690 B
TypeScript
20 lines
690 B
TypeScript
import path from "path";
|
|
import { getInstanceRoot } from "app/server/lib/places";
|
|
import { IGristCoreConfig, loadGristCoreConfigFile } from "app/server/lib/configCore";
|
|
import log from "app/server/lib/log";
|
|
|
|
const globalConfigPath: string = path.join(getInstanceRoot(), 'config.json');
|
|
let cachedGlobalConfig: IGristCoreConfig | undefined = undefined;
|
|
|
|
/**
|
|
* Retrieves the cached grist config, or loads it from the default global path.
|
|
*/
|
|
export function getGlobalConfig(): IGristCoreConfig {
|
|
if (!cachedGlobalConfig) {
|
|
log.info(`Loading config file from ${globalConfigPath}`);
|
|
cachedGlobalConfig = loadGristCoreConfigFile(globalConfigPath);
|
|
}
|
|
|
|
return cachedGlobalConfig;
|
|
}
|