Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Normalize config properties in otherHosts
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachase committed Jul 8, 2020
1 parent 94da096 commit 594d74c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@ if (typeof userConfig.logo === "string") {
userConfig.logo = {"main": userConfig.logo};
}

for (const password of userConfig.password) {
for (const host in (userConfig.otherHosts || {})) {
const hostCfg = userConfig.otherHosts[host];

if (typeof hostCfg.password === "string") {
hostCfg.password = [hostCfg.password];
}

if (typeof hostCfg.logo === "string") {
hostCfg.logo = {"main": hostCfg.logo};
}
}

for (const password of _.concat(userConfig.password, _.map(userConfig.otherHosts, "password").filter(x => !!x))) {
if (!password.match(/^[0-9a-f]{64}$/i)) {
console.error("Password does not look like an sha256 hash. Read the damn docs");
process.exit(0);
Expand Down

0 comments on commit 594d74c

Please sign in to comment.