strapi-utils
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -60,4 +60,22 @@ const _ = require('lodash'); | ||
const getAbsoluteUrl = adminOrServer => (config, forAdminBuild = false) => { | ||
const { serverUrl, adminUrl } = getConfigUrls(config.server, forAdminBuild); | ||
let url = adminOrServer === 'server' ? serverUrl : adminUrl; | ||
if (url.startsWith('http')) { | ||
return url; | ||
} | ||
let hostname = | ||
config.environment === 'development' && ['127.0.0.1', '0.0.0.0'].includes(config.server.host) | ||
? 'localhost' | ||
: config.server.host; | ||
return `http://${hostname}:${config.server.port}${url}`; | ||
}; | ||
module.exports = { | ||
getConfigUrls, | ||
getAbsoluteAdminUrl: getAbsoluteUrl('admin'), | ||
getAbsoluteServerUrl: getAbsoluteUrl('server'), | ||
}; |
@@ -25,3 +25,3 @@ 'use strict'; | ||
const { removeUndefined } = require('./objectFormatting'); | ||
const { getConfigUrls } = require('./config'); | ||
const { getConfigUrls, getAbsoluteAdminUrl, getAbsoluteServerUrl } = require('./config'); | ||
@@ -47,2 +47,4 @@ module.exports = { | ||
removeUndefined, | ||
getAbsoluteAdminUrl, | ||
getAbsoluteServerUrl, | ||
}; |
{ | ||
"name": "strapi-utils", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Shared utilities for the Strapi packages", | ||
@@ -49,3 +49,3 @@ "homepage": "http://strapi.io", | ||
"license": "MIT", | ||
"gitHead": "6bb7a7f198b13b0780547285d4214704ce991c23" | ||
"gitHead": "5b64e05d7f565d359f28dccb9d9917124d1ad453" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65230
1913