mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 06:48:47 +00:00
Refactor info widget sanitizing / privateOptions
This commit is contained in:
parent
dced918804
commit
48a09e5a99
6 changed files with 89 additions and 53 deletions
|
@ -33,17 +33,4 @@ export function getSettings() {
|
|||
const settingsYaml = join(process.cwd(), "config", "settings.yaml");
|
||||
const fileContents = readFileSync(settingsYaml, "utf8");
|
||||
return yaml.load(fileContents);
|
||||
}
|
||||
|
||||
export function sanitizePrivateOptions(options, privateOnly = false) {
|
||||
const privateOptions = ["url", "username", "password", "key"];
|
||||
const sanitizedOptions = {};
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (!privateOnly && !privateOptions.includes(key)) {
|
||||
sanitizedOptions[key] = options[key];
|
||||
} else if (privateOnly && privateOptions.includes(key)) {
|
||||
sanitizedOptions[key] = options[key];
|
||||
}
|
||||
});
|
||||
return sanitizedOptions;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue