@forklaunch/core 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/http/index.js +3 -1
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +3 -1
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/middleware/request/cors.middleware.d.ts +6 -1
- package/lib/http/middleware/request/cors.middleware.d.ts.map +1 -1
- package/lib/http/types/expressLikeOptions.d.ts +11 -6
- package/lib/http/types/expressLikeOptions.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/http/index.mjs
CHANGED
|
@@ -89,6 +89,7 @@ function bindRuntimeAuth(details, binding) {
|
|
|
89
89
|
// src/http/middleware/request/cors.middleware.ts
|
|
90
90
|
import corsMiddleware from "cors";
|
|
91
91
|
var CORS_ORIGINS_ENV = "CORS_ORIGINS";
|
|
92
|
+
var CORS_FROM_ENVIRONMENT = "environment";
|
|
92
93
|
var LOCAL_DEVELOPMENT_ORIGIN = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d{1,5})?$/;
|
|
93
94
|
function parseCorsOrigins(value) {
|
|
94
95
|
const origins = [];
|
|
@@ -120,7 +121,8 @@ function defaultCorsOrigin(env) {
|
|
|
120
121
|
function withoutWildcardCredentials(options2) {
|
|
121
122
|
return options2.credentials === true && isWildcardOrigin(options2.origin) ? { ...options2, credentials: false } : options2;
|
|
122
123
|
}
|
|
123
|
-
function resolveCorsOptions(
|
|
124
|
+
function resolveCorsOptions(appCorsOption, env = process.env) {
|
|
125
|
+
const appCors = appCorsOption === CORS_FROM_ENVIRONMENT ? void 0 : appCorsOption;
|
|
124
126
|
const howToConfigure = `Set ${CORS_ORIGINS_ENV} to a comma separated list of allowed origins (for example ${CORS_ORIGINS_ENV}=https://app.example.com), or pass \`cors: { origin: [...] }\` in the application options.`;
|
|
125
127
|
if (appCors !== void 0) {
|
|
126
128
|
if (appCors.credentials === true && isWildcardOrigin(appCors.origin)) {
|