Skip to content

Commit 696e7ed

Browse files
committedJul 28, 2022
fix: use env to add origins
1 parent 32feefe commit 696e7ed

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed
 

‎config/default.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@
2727
},
2828
"mongodb": "mongodb://localhost:27017/sintax_backend",
2929
"postFolderPath": "sintax_test/posts",
30-
"userFolderPath": "sintax_test/user"
30+
"userFolderPath": "sintax_test/user",
31+
"origin": "ORIGIN",
32+
"origni-two": "ORIGIN_TWO"
3133
}

‎config/production.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"port": "PORT",
44
"mongodb": "MONGO_URL",
55
"postFolderPath": "sintax/posts",
6-
"userFolderPath": "sintax/user"
6+
"userFolderPath": "sintax/user",
7+
"origin": "ORIGIN",
8+
"origni-two": "ORIGIN_TWO"
79
}

‎src/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ app.use(
2929
contentSecurityPolicy: false,
3030
})
3131
);
32-
var corsOptions = {
33-
origin: "https://sintax.rishupatel.in",
32+
const corsOptions = {
33+
origin: [app.get("origin"), app.get("origin-two")],
3434
optionsSuccessStatus: 200,
3535
};
3636

0 commit comments

Comments
 (0)
Please sign in to comment.