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/app/settings/server/functions/overrideGenerator.ts

24 lines
579 B

import { ISetting } from '../../../../definition/ISetting';
import { convertValue } from './convertValue';
export const overrideGenerator =
(fn: (key: string) => string | undefined) =>
(setting: ISetting): ISetting => {
const overwriteValue = fn(setting._id);
if (overwriteValue === null || overwriteValue === undefined) {
return setting;
}
const value = convertValue(overwriteValue, setting.type);
if (value === setting.value) {
return setting;
}
return {
...setting,
value,
processEnvValue: value,
valueSource: 'processEnvValue',
};
};