@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.js
CHANGED
|
@@ -247,6 +247,7 @@ function bindRuntimeAuth(details, binding) {
|
|
|
247
247
|
// src/http/middleware/request/cors.middleware.ts
|
|
248
248
|
var import_cors = __toESM(require("cors"));
|
|
249
249
|
var CORS_ORIGINS_ENV = "CORS_ORIGINS";
|
|
250
|
+
var CORS_FROM_ENVIRONMENT = "environment";
|
|
250
251
|
var LOCAL_DEVELOPMENT_ORIGIN = /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d{1,5})?$/;
|
|
251
252
|
function parseCorsOrigins(value) {
|
|
252
253
|
const origins = [];
|
|
@@ -278,7 +279,8 @@ function defaultCorsOrigin(env) {
|
|
|
278
279
|
function withoutWildcardCredentials(options2) {
|
|
279
280
|
return options2.credentials === true && isWildcardOrigin(options2.origin) ? { ...options2, credentials: false } : options2;
|
|
280
281
|
}
|
|
281
|
-
function resolveCorsOptions(
|
|
282
|
+
function resolveCorsOptions(appCorsOption, env = process.env) {
|
|
283
|
+
const appCors = appCorsOption === CORS_FROM_ENVIRONMENT ? void 0 : appCorsOption;
|
|
282
284
|
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.`;
|
|
283
285
|
if (appCors !== void 0) {
|
|
284
286
|
if (appCors.credentials === true && isWildcardOrigin(appCors.origin)) {
|