From 01a9db76c807f55d4de3a8129a1dc654f1b1eb1f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 27 Apr 2021 17:30:19 +0100 Subject: [PATCH] Formatting. --- packages/auth/src/redis/index.js | 37 ++++++++++++--------- packages/worker/src/api/controllers/auth.js | 1 - packages/worker/src/utilities/email.js | 7 +--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/packages/auth/src/redis/index.js b/packages/auth/src/redis/index.js index 3d7253e624..b81c3aee74 100644 --- a/packages/auth/src/redis/index.js +++ b/packages/auth/src/redis/index.js @@ -15,9 +15,9 @@ let CLIENT */ function init() { return new Promise((resolve, reject) => { - const [ host, port ] = env.REDIS_URL.split(":") + const [host, port] = env.REDIS_URL.split(":") const opts = { - connectTimeout: CONNECT_TIMEOUT_MS + connectTimeout: CONNECT_TIMEOUT_MS, } if (CLUSTERED) { opts.redisOptions = {} @@ -25,7 +25,7 @@ function init() { opts.redisOptions.password = env.REDIS_PASSWORD opts.slotsRefreshTimeout = SLOT_REFRESH_MS opts.dnsLookup = (address, callback) => callback(null, address) - CLIENT = new Redis.Cluster([ { port, host } ]) + CLIENT = new Redis.Cluster([{ port, host }]) } else { opts.password = env.REDIS_PASSWORD opts.port = port @@ -58,7 +58,7 @@ function promisifyStream(stream) { outputKeys.add(key) }) }) - stream.on("error", (err) => { + stream.on("error", err => { reject(err) }) stream.on("end", async () => { @@ -69,10 +69,12 @@ function promisifyStream(stream) { getPromises.push(CLIENT.get(key)) } const jsonArray = await Promise.all(getPromises) - resolve(keysArray.map(key => ({ - key: removeDbPrefix(key), - value: JSON.parse(jsonArray.shift()), - }))) + resolve( + keysArray.map(key => ({ + key: removeDbPrefix(key), + value: JSON.parse(jsonArray.shift()), + })) + ) } catch (err) { reject(err) } @@ -91,20 +93,21 @@ class RedisWrapper { } async scan() { - const db = this._db, client = this._client + const db = this._db, + client = this._client let stream if (CLUSTERED) { let node = client.nodes("master") - stream = node[0].scanStream({match: db + "-*", count: 100}) - + stream = node[0].scanStream({ match: db + "-*", count: 100 }) } else { - stream = client.scanStream({match: db + "-*", count: 100}) + stream = client.scanStream({ match: db + "-*", count: 100 }) } return promisifyStream(stream) } async get(key) { - const db = this._db, client = this._client + const db = this._db, + client = this._client let response = await client.get(addDbPrefix(db, key)) // overwrite the prefixed key if (response != null && response.key) { @@ -114,8 +117,9 @@ class RedisWrapper { } async store(key, value, expirySeconds = null) { - const db = this._db, client = this._client - if (typeof(value) === "object") { + const db = this._db, + client = this._client + if (typeof value === "object") { value = JSON.stringify(value) } const prefixedKey = addDbPrefix(db, key) @@ -126,7 +130,8 @@ class RedisWrapper { } async delete(key) { - const db = this._db, client = this._client + const db = this._db, + client = this._client await client.del(addDbPrefix(db, key)) } diff --git a/packages/worker/src/api/controllers/auth.js b/packages/worker/src/api/controllers/auth.js index 05895c8358..15c38e7f09 100644 --- a/packages/worker/src/api/controllers/auth.js +++ b/packages/worker/src/api/controllers/auth.js @@ -47,7 +47,6 @@ exports.reset = async ctx => { try { const user = getGlobalUserByEmail(email) if (user) { - } } catch (err) { // don't throw any kind of error to the user, this might give away something diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index f1059c081e..23af1ab623 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -1,11 +1,7 @@ const nodemailer = require("nodemailer") const CouchDB = require("../db") const { StaticDatabases, determineScopedConfig } = require("@budibase/auth").db -const { - EmailTemplatePurpose, - TemplateTypes, - Configs, -} = require("../constants") +const { EmailTemplatePurpose, TemplateTypes, Configs } = require("../constants") const { getTemplateByPurpose } = require("../constants/templates") const { getSettingsTemplateContext } = require("./templates") const { processString } = require("@budibase/string-templates") @@ -94,7 +90,6 @@ exports.sendEmail = async (email, purpose, { groupId, userId }) => { return transport.sendMail(message) } - exports.verifyConfig = async config => { const transport = createSMTPTransport(config) await transport.verify()