rrd108 / nuxt-api-shield

Nuxt API Rate Limiter / Brute Force Protection
5 stars 2 forks source link

Warning Configuration #11

Closed roneydourados closed 1 hour ago

roneydourados commented 1 week ago

Helo.....

My configuration in nuxtconfig:

{
  "nitro": {
    "experimental": {
      "tasks": true
    },
    "scheduledTasks": {
      "*/15 * * * *": [
        "shield:clean"
      ]
    },
    "storage": {
      "shield": {
        "driver": "memory"
      }
    }
  },
  "nuxtApiShield": {
    "errorMessage": "Too Many Requests",
    "limit": {
      "ban": 3600,
      "duration": 108,
      "max": 100
    },
    "log": false,
    "retryAfterHeader": false
  }
}

When I run the project, return warning:

WARN Scheduled task shield:clean is not defined!

rrd108 commented 1 week ago

What version do you use?

rrd108 commented 1 week ago

I see what is the problem here. I missed this part from the readme.

You should create your own clean task at server/tasks/shield/clean.ts

I added an example in the readme: https://github.com/rrd108/nuxt-api-shield?tab=readme-ov-file#5-create-your-clean-task

rrd108 commented 6 hours ago

I reopened this isseu as I run into a problem related to this.