The communications platform that puts data protection first.
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.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/lib/meteorRuntimeConfig.ts

23 lines
850 B

// Single point of access to the `__meteor_runtime_config__` globals that
// Meteor's bootloader injects into the page (ROOT_URL and
// ROOT_URL_PATH_PREFIX). Consumers must read/write through these helpers so
// the eventual replacement (a static config injected at build time) is a
// single-file swap.
const getConfig = (): { ROOT_URL?: string; ROOT_URL_PATH_PREFIX?: string } | undefined => {
if (typeof __meteor_runtime_config__ !== 'object' || __meteor_runtime_config__ === null) {
return undefined;
}
return __meteor_runtime_config__;
};
export const getRootUrl = (): string | undefined => getConfig()?.ROOT_URL;
export const getRootUrlPathPrefix = (): string => getConfig()?.ROOT_URL_PATH_PREFIX ?? '';
export const setRootUrl = (value: string): void => {
const config = getConfig();
if (config) {
config.ROOT_URL = value;
}
};