aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-before-init.ts3
-rw-r--r--server/initializers/config.ts10
-rw-r--r--server/initializers/constants.ts8
3 files changed, 16 insertions, 5 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index 223ef8078..622ad7d6b 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -27,7 +27,8 @@ function checkMissedConfig () {
27 'services.twitter.username', 'services.twitter.whitelisted', 27 'services.twitter.username', 'services.twitter.whitelisted',
28 'followers.instance.enabled', 'followers.instance.manual_approval', 28 'followers.instance.enabled', 'followers.instance.manual_approval',
29 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces', 29 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces',
30 'history.videos.max_age', 'views.videos.remote.max_age' 30 'history.videos.max_age', 'views.videos.remote.max_age',
31 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max'
31 ] 32 ]
32 const requiredAlternatives = [ 33 const requiredAlternatives = [
33 [ // set 34 [ // set
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index baf502305..4f77e144d 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -63,6 +63,16 @@ const CONFIG = {
63 HOSTNAME: config.get<string>('webserver.hostname'), 63 HOSTNAME: config.get<string>('webserver.hostname'),
64 PORT: config.get<number>('webserver.port') 64 PORT: config.get<number>('webserver.port')
65 }, 65 },
66 RATES_LIMIT: {
67 LOGIN: {
68 WINDOW_MS: parseDurationToMs(config.get<string>('rates_limit.login.window')),
69 MAX: config.get<number>('rates_limit.login.max')
70 },
71 ASK_SEND_EMAIL: {
72 WINDOW_MS: parseDurationToMs(config.get<string>('rates_limit.ask_send_email.window')),
73 MAX: config.get<number>('rates_limit.ask_send_email.max')
74 }
75 },
66 TRUST_PROXY: config.get<string[]>('trust_proxy'), 76 TRUST_PROXY: config.get<string[]>('trust_proxy'),
67 LOG: { 77 LOG: {
68 LEVEL: config.get<string>('log.level') 78 LEVEL: config.get<string>('log.level')
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 2be364cc8..193bae5b5 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -281,12 +281,12 @@ let CONSTRAINTS_FIELDS = {
281 281
282const RATES_LIMIT = { 282const RATES_LIMIT = {
283 LOGIN: { 283 LOGIN: {
284 WINDOW_MS: 5 * 60 * 1000, // 5 minutes 284 WINDOW_MS: CONFIG.RATES_LIMIT.LOGIN.WINDOW_MS,
285 MAX: 15 // 15 attempts 285 MAX: CONFIG.RATES_LIMIT.LOGIN.MAX
286 }, 286 },
287 ASK_SEND_EMAIL: { 287 ASK_SEND_EMAIL: {
288 WINDOW_MS: 5 * 60 * 1000, // 5 minutes 288 WINDOW_MS: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS,
289 MAX: 3 // 3 attempts 289 MAX: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.MAX
290 } 290 }
291} 291}
292 292