diff --git a/packages/governor/src/index.js b/packages/governor/src/index.js index 9be63a8..ff8b4c5 100644 --- a/packages/governor/src/index.js +++ b/packages/governor/src/index.js @@ -1,19 +1 @@ -export default { - hooks: { - '@latus/core/config': () => ({ - keys: ['ip'], - http: { - keys: ['ip'], - points: 60, - duration: 30, - ttl: 30, - }, - socket: { - keys: ['ip'], - points: 60, - duration: 30, - ttl: 30, - }, - }), - }, -}; +export default {}; diff --git a/packages/governor/src/models/ban.js b/packages/governor/src/models/ban.js index 05c522c..0e5ac83 100644 --- a/packages/governor/src/models/ban.js +++ b/packages/governor/src/models/ban.js @@ -4,7 +4,7 @@ import { } from '@latus/db/server'; export default (latus) => { - const {config: {'@latus/governor': {keys}}} = latus; + const {config: {'@latus/governor/server': {keys}}} = latus; return class Ban extends Model { static get attributes() { diff --git a/packages/governor/src/server.js b/packages/governor/src/server.js index 18446fa..fe27a13 100644 --- a/packages/governor/src/server.js +++ b/packages/governor/src/server.js @@ -7,11 +7,26 @@ export {default as createLimiter} from './limiter'; export default { hooks: { + '@latus/core/config': () => ({ + keys: ['ip'], + http: { + keys: ['ip'], + points: 60, + duration: 30, + ttl: 30, + }, + socket: { + keys: ['ip'], + points: 60, + duration: 30, + ttl: 30, + }, + }), '@latus/db/server/models': gatherWithLatus( require.context('./models', false, /\.js$/), ), '@latus/http/request': (latus) => { - const {config: {'@latus/governor': {http}}} = latus; + const {config: {'@latus/governor/server': {http}}} = latus; const limiter = createLimiter(latus, { keyPrefix: '@latus/http/request', ...http, @@ -43,7 +58,7 @@ export default { }; }, '@latus/socket/authenticate': (latus) => { - const {config: {'@latus/governor': {socket}}} = latus; + const {config: {'@latus/governor/server': {socket}}} = latus; const limiter = createLimiter(latus, { keyPrefix: '@latus/socket/authenticate', ...socket,