27 lines
628 B
TypeScript
27 lines
628 B
TypeScript
import env from "#start/env.ts"
|
|
import { defineConfig, stores } from "@adonisjs/limiter"
|
|
|
|
const limiterConfig = defineConfig({
|
|
default: env.get("LIMITER_STORE"),
|
|
stores: {
|
|
/**
|
|
* Database store to save rate limiting data inside a database.
|
|
*/
|
|
database: stores.database({
|
|
tableName: "rate_limits",
|
|
clearExpiredByTimeout: true,
|
|
}),
|
|
|
|
/**
|
|
* Memory store could be used during testing.
|
|
*/
|
|
memory: stores.memory({}),
|
|
},
|
|
})
|
|
|
|
export default limiterConfig
|
|
|
|
declare module "@adonisjs/limiter/types" {
|
|
export interface LimitersList extends InferLimiters<typeof limiterConfig> {}
|
|
}
|