Skip to content

Commit

Permalink
Fix hung default (#1909)
Browse files Browse the repository at this point in the history
* Add another default. This is a breaking change for third-party instances so version bump

Closes #1745 and applies to #1548

NOTE:
* Issue #1745 has been hung for over a year. If needed may be reopened by appropriate personnel.

Auto-merge
  • Loading branch information
Martii authored Dec 28, 2021
1 parent 4e3ab2b commit a8da02a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion models/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"secret" : "someSecretStringForSession",
"connect" : "mongodb://dev:oujs123@ds131963.mlab.com:31963/openuserjs_devel",
"connect" : "mongodb://dev:oujs123@localhost/openuserjs_devel",
"limiter" : "mongodb://dev:oujs123@localhost:27017",
"maximum_upload_script_size": 1048576,
"ttl": {
"minimum": 2,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "OpenUserJS.org",
"description": "An open source user scripts repo built using Node.js",
"version": "0.5.2",
"version": "0.5.3",
"main": "app",
"dependencies": {
"ace-builds": "1.4.13",
Expand Down
11 changes: 6 additions & 5 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ var statusCodePage = require('./libs/templateHelpers').statusCodePage;
var settings = require('./models/settings.json');

//--
var limiter = process.env.LIMITER_STRING || settings.limiter;

var waitInstallMin = isDev ? 1 : 60;
var installLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
uri: 'mongodb://127.0.0.1:27017/installLimiter',
uri: limiter + '/installLimiter',
resetExpireDateOnChange: true, // Rolling
expireTimeMs: waitInstallMin * 60 * 1000 // n minutes for mongo store
})),
Expand All @@ -55,7 +56,7 @@ var installLimiter = rateLimit({
var waitApiMin = isDev ? 1: 15;
var apiLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
uri: 'mongodb://127.0.0.1:27017/apiLimiter',
uri: limiter + '/apiLimiter',
resetExpireDateOnChange: true, // Rolling
expireTimeMs: waitApiMin * 60 * 1000 // n minutes for mongo store
})),
Expand All @@ -70,7 +71,7 @@ var apiLimiter = rateLimit({
var waitAuthMin = isDev ? 1: 1440;
var authLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
uri: 'mongodb://127.0.0.1:27017/authLimiter',
uri: limiter + '/authLimiter',
resetExpireDateOnChange: true, // Rolling
expireTimeMs: waitAuthMin * 60 * 1000 // n minutes for mongo store
})),
Expand All @@ -94,7 +95,7 @@ var authLimiter = rateLimit({
var waitCaptchaMin = isDev ? 1: 1440;
var captchaLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
uri: 'mongodb://127.0.0.1:27017/captchaLimiter',
uri: limiter + '/captchaLimiter',
resetExpireDateOnChange: true, // Rolling
expireTimeMs: waitCaptchaMin * 60 * 1000 // n minutes for mongo store
})),
Expand All @@ -112,7 +113,7 @@ var captchaLimiter = rateLimit({
var listMin = isDev ? 1: 60;
var listLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
uri: 'mongodb://127.0.0.1:27017/listLimiter',
uri: limiter + '/listLimiter',
resetExpireDateOnChange: true, // Rolling
expireTimeMs: listMin * 60 * 1000 // n minutes for mongo store
})),
Expand Down

0 comments on commit a8da02a

Please sign in to comment.