Skip to content

Commit

Permalink
Merge pull request #407 from bluewave-labs/ip-check-variable
Browse files Browse the repository at this point in the history
activated ip check only if the env var is true
  • Loading branch information
erenfn authored Dec 20, 2024
2 parents 297ae8d + be2c8b3 commit acc7881
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TEST_DB_NAME=onboarding_db_test
TEST_DB_HOST=localhost
TEST_DB_PORT=5432

ENABLE_IP_CHECK=false
# Allowed IP range for the API "baseIp/rangeStart-rangeEnd" (e.g. 192.168.1/1-255) separated by comma
ALLOWED_IP_RANGE=11.22.33/10-200, 192.168.65/1-255
# Allowed IP addresses for the API separated by comma
Expand Down
1 change: 1 addition & 0 deletions backend/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PROD_DB_PORT=5432
# JWT Secret Key
JWT_SECRET=your_prod_jwt_secret_key_here

ENABLE_IP_CHECK=false
# Allowed IP range for the API "baseIp/rangeStart-rangeEnd" (e.g. 192.168.1/1-255) separated by comma
ALLOWED_IP_RANGE=11.22.33/10-200
# Allowed IP addresses for the API separated by comma
Expand Down
1 change: 1 addition & 0 deletions backend/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ POSTGRES_DB=onboarding_db_test
# JWT Secret Key
JWT_SECRET=your_test_jwt_secret_key_here

ENABLE_IP_CHECK=false
# Allowed IP range for the API "baseIp/rangeStart-rangeEnd" (e.g. 192.168.1/1-255) separated by comma
ALLOWED_IP_RANGE=11.22.33/10-200, 192.168.65/1-255
# Allowed IP addresses for the API separated by comma
Expand Down
4 changes: 3 additions & 1 deletion backend/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ app.use(cors());
app.use(helmet());
app.use(bodyParser.json({ limit: MAX_FILE_SIZE }));
app.use(jsonErrorMiddleware);
app.use(ipFilter);
if (process.env.ENABLE_IP_CHECK === 'true') {
app.use(ipFilter);
}
// app.use(fileSizeValidator);

const { sequelize } = require("./models");
Expand Down

0 comments on commit acc7881

Please sign in to comment.