@liberstudio/cloudflare-list 2.0.15 → 2.0.17

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.
package/README.md CHANGED
@@ -56,7 +56,7 @@ import { CloudflareAttacksModule } from "@liberstudio/cloudflare-list";
56
56
  accountId: config.getOrThrow<string>('CLOUDFLARE_ACCOUNT_ID'),
57
57
  listId: config.getOrThrow<string>('CLOUDFLARE_LIST_ID'),
58
58
  comment: config.get<string>('CLOUDFLARE_LIST_COMMENT') || 'Blocked',
59
- logPath: config.get<string>('CLOUDFLARE_LIST_LOG_PATH') || 'Blocked',
59
+ logPath: config.get<string>('CLOUDFLARE_LIST_LOG_PATH') || '/var/log/nestjs-attacks.log',
60
60
  })
61
61
  }),
62
62
  ],
@@ -29,15 +29,15 @@ let AttackLoggerMiddleware = AttackLoggerMiddleware_1 = class AttackLoggerMiddle
29
29
  if (!options.logPath || typeof options.logPath !== "string") {
30
30
  throw new Error("CloudflareAttacksOptions.logPath deve essere una stringa valida");
31
31
  }
32
- const absolutePath = (0, path_1.resolve)(options.logPath);
33
- this.ensureDirectoryExists(absolutePath);
34
- this.stream = (0, fs_1.createWriteStream)(absolutePath, {
32
+ const logPath = (0, path_1.join)(process.cwd(), options.logPath);
33
+ this.ensureDirectoryExists(logPath);
34
+ this.stream = (0, fs_1.createWriteStream)(logPath, {
35
35
  flags: "a",
36
36
  encoding: "utf8",
37
37
  highWaterMark: 64 * 1024,
38
38
  });
39
39
  this.stream.on("error", (err) => {
40
- this.logger.error(`Errore nello stream del log (${absolutePath}): ${err.message}`);
40
+ this.logger.error(`Errore nello stream del log (${logPath}): ${err.message}`);
41
41
  });
42
42
  }
43
43
  use(req, res, next) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liberstudio/cloudflare-list",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "description": "Modulo NestJS per gestione IP List Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",