refactor(security): governor
This commit is contained in:
parent
ec18e88e3d
commit
47440a025a
|
@ -1,19 +1 @@
|
||||||
export default {
|
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,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
} from '@latus/db/server';
|
} from '@latus/db/server';
|
||||||
|
|
||||||
export default (latus) => {
|
export default (latus) => {
|
||||||
const {config: {'@latus/governor': {keys}}} = latus;
|
const {config: {'@latus/governor/server': {keys}}} = latus;
|
||||||
return class Ban extends Model {
|
return class Ban extends Model {
|
||||||
|
|
||||||
static get attributes() {
|
static get attributes() {
|
||||||
|
|
|
@ -7,11 +7,26 @@ export {default as createLimiter} from './limiter';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
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(
|
'@latus/db/server/models': gatherWithLatus(
|
||||||
require.context('./models', false, /\.js$/),
|
require.context('./models', false, /\.js$/),
|
||||||
),
|
),
|
||||||
'@latus/http/request': (latus) => {
|
'@latus/http/request': (latus) => {
|
||||||
const {config: {'@latus/governor': {http}}} = latus;
|
const {config: {'@latus/governor/server': {http}}} = latus;
|
||||||
const limiter = createLimiter(latus, {
|
const limiter = createLimiter(latus, {
|
||||||
keyPrefix: '@latus/http/request',
|
keyPrefix: '@latus/http/request',
|
||||||
...http,
|
...http,
|
||||||
|
@ -43,7 +58,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
'@latus/socket/authenticate': (latus) => {
|
'@latus/socket/authenticate': (latus) => {
|
||||||
const {config: {'@latus/governor': {socket}}} = latus;
|
const {config: {'@latus/governor/server': {socket}}} = latus;
|
||||||
const limiter = createLimiter(latus, {
|
const limiter = createLimiter(latus, {
|
||||||
keyPrefix: '@latus/socket/authenticate',
|
keyPrefix: '@latus/socket/authenticate',
|
||||||
...socket,
|
...socket,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user