Skip to content

Commit

Permalink
Merge pull request #3648 from LiteFarmOrg/integration
Browse files Browse the repository at this point in the history
Patch 3.7.4
  • Loading branch information
SayakaOno authored Jan 14, 2025
2 parents 0a6a65e + 0f11ccc commit 8ae8674
Show file tree
Hide file tree
Showing 28 changed files with 4,935 additions and 4,103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_translation_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up pnpm
uses: pnpm/[email protected]
with:
version: 6.26.1
version: latest

- name: Install pnpm dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/webapp_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 6.26.1
version: latest
- name: Install dependencies
run: pnpm install
- name: Run unit tests
Expand Down
4 changes: 2 additions & 2 deletions packages/api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "litefarm-api",
"version": "3.7.3",
"version": "3.7.4",
"description": "LiteFarm API server",
"main": "./api/src/server.js",
"type": "module",
Expand Down
18 changes: 16 additions & 2 deletions packages/api/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (process.env.SENTRY_DSN && environment !== 'development') {
// Automatically instrument Node.js libraries and frameworks
...Sentry.autoDiscoverNodePerformanceMonitoringIntegrations(),
],
release: '3.7.3',
release: '3.7.4',
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
Expand Down Expand Up @@ -252,6 +252,19 @@ const rejectBodyInGetAndDelete = (req, res, next) => {
next();
};

const getAllowedOrigin = () => {
switch (environment) {
case 'development':
return 'http://localhost:3000';
case 'integration':
return 'https://beta.litefarm.org';
case 'production':
return 'https://app.litefarm.org';
default:
return 'https://app.litefarm.org';
}
};

app
.use(applyExpressJSON)
.use(express.urlencoded({ extended: true }))
Expand All @@ -260,7 +273,8 @@ app
// prevent CORS errors
.use(cors())
.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
const origin = getAllowedOrigin();
res.header('Access-Control-Allow-Origin', origin);
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept, Authorization',
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ http {

proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
proxy_pass_request_headers on;
proxy_set_header 'Access-Control-Allow-Origin' '*';
proxy_set_header 'Access-Control-Allow-Origin' 'https://beta.litefarm.org';
proxy_pass http://backend:5000/;
}
listen 443 ssl; # managed by Certbot
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "litefarm-webapp",
"version": "3.7.3",
"version": "3.7.4",
"description": "LiteFarm Web application",
"type": "module",
"scripts": {
Expand Down
Loading

0 comments on commit 8ae8674

Please sign in to comment.