You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
711 B
20 lines
711 B
2 months ago
|
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 async function getGlobalConfig(): Promise<IGristCoreConfig> {
|
||
|
if (!cachedGlobalConfig) {
|
||
|
log.info(`Loading config file from ${globalConfigPath}`);
|
||
|
cachedGlobalConfig = await loadGristCoreConfigFile(globalConfigPath);
|
||
|
}
|
||
|
|
||
|
return cachedGlobalConfig;
|
||
|
}
|