refactor(security): governor
This commit is contained in:
parent
ec18e88e3d
commit
47440a025a
|
@ -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 {};
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user