Skip to content

Commit 7ff0c18

Browse files
committed
Custom rate limit from config
1 parent 3cd9188 commit 7ff0c18

9 files changed

Lines changed: 13 additions & 9 deletions

OpenFlow/src/Config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export class Config {
4141
Config.tls_passphrase = Config.getEnv("tls_passphrase", "");
4242

4343
Config.api_credential_cache_seconds = parseInt(Config.getEnv("api_credential_cache_seconds", "60000"));
44+
Config.api_rate_limit_points = parseInt(Config.getEnv("api_rate_limit_points", "40"));
45+
Config.api_rate_limit_duration = parseInt(Config.getEnv("api_rate_limit_duration", "5"));
4446

4547
Config.client_heartbeat_timeout = parseInt(Config.getEnv("client_heartbeat_timeout", "60"));
4648

@@ -115,6 +117,8 @@ export class Config {
115117
public static tls_passphrase: string = Config.getEnv("tls_passphrase", "");
116118

117119
public static api_credential_cache_seconds: number = parseInt(Config.getEnv("api_credential_cache_seconds", "60000"));
120+
public static api_rate_limit_points: number = parseInt(Config.getEnv("api_rate_limit_points", "40"));
121+
public static api_rate_limit_duration: number = parseInt(Config.getEnv("api_rate_limit_duration", "5"));
118122

119123
public static client_heartbeat_timeout: number = parseInt(Config.getEnv("client_heartbeat_timeout", "60"));
120124

OpenFlow/src/LoginProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import { DBHelper } from "./DBHelper";
2727
const safeObjectID = (s: string | number | ObjectID) => ObjectID.isValid(s) ? new ObjectID(s) : null;
2828

2929
const BaseRateLimiter = new RateLimiterMemory({
30-
points: 60,
31-
duration: 1,
30+
points: Config.api_rate_limit_points,
31+
duration: Config.api_rate_limit_duration,
3232
});
3333

3434
const rateLimiter = (req: express.Request, res: express.Response, next: express.NextFunction): void => {

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openflow-nodered",
3-
"version": "1.1.58",
3+
"version": "1.1.59",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.58
1+
1.1.59

docker-compose-toolbox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ services:
4545
- "traefik.http.routers.web.rule=Host(`toolbox.openrpa.dk`)"
4646
- "traefik.http.routers.web.entrypoints=web"
4747
- "traefik.frontend.passHostHeader=true"
48-
image: "cloudhack/openflow:1.1.50"
48+
image: "cloudhack/openflow:1.1.59"
4949
container_name: "web"
5050
environment:
5151
- update_acl_based_on_groups=true

docker-compose-traefik-letsencrypt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ services:
6969
- "traefik.http.routers.web.entrypoints=web,websecure"
7070
- "traefik.frontend.passHostHeader=true"
7171
- "traefik.http.routers.web.tls.certresolver=myresolver"
72-
image: "cloudhack/openflow:1.1.50"
72+
image: "cloudhack/openflow:1.1.59"
7373
container_name: "web"
7474
environment:
7575
- update_acl_based_on_groups=true

docker-compose-traefik.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ services:
4545
- "traefik.http.routers.web.rule=Host(`localhost.openrpa.dk`)"
4646
- "traefik.http.routers.web.entrypoints=web"
4747
- "traefik.frontend.passHostHeader=true"
48-
image: "cloudhack/openflow:1.1.50"
48+
image: "cloudhack/openflow:1.1.59"
4949
container_name: "web"
5050
environment:
5151
- update_acl_based_on_groups=true

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
- "5672:5672"
1919
- "15672:15672"
2020
web:
21-
image: "cloudhack/openflow:1.1.58"
21+
image: "cloudhack/openflow:1.1.59"
2222
environment:
2323
- update_acl_based_on_groups=true
2424
- multi_tenant=false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openiap",
3-
"version": "1.1.58",
3+
"version": "1.1.59",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)