@less-is-more/less-js 1.2.18 → 1.2.19-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/redis.js +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@less-is-more/less-js",
3
- "version": "1.2.18",
3
+ "version": "1.2.19-1",
4
4
  "description": "Fast develop kit for nodejs",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/redis.js CHANGED
@@ -15,11 +15,14 @@ module.exports = class Redis {
15
15
  static async getInstance() {
16
16
  if (!this.#client) {
17
17
  if (this.#host) {
18
- this.#client = await redis.createClient({
18
+ let params = {
19
19
  socket: { host: this.#host },
20
- username: this.#user,
21
- password: this.#password,
22
- });
20
+ };
21
+ if (this.#password) {
22
+ params.username = this.#user;
23
+ params.password = this.#password;
24
+ }
25
+ this.#client = await redis.createClient(params);
23
26
  await this.#client.connect();
24
27
  } else {
25
28
  throw new Error("Redis not init");