mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 22:13:02 +00:00
74615: Remove workaround for baseUrl ending in /api
This commit is contained in:
@@ -54,13 +54,6 @@ import(environmentFilePath)
|
|||||||
function generateEnvironmentFile(file: GlobalConfig): void {
|
function generateEnvironmentFile(file: GlobalConfig): void {
|
||||||
file.production = production;
|
file.production = production;
|
||||||
buildBaseUrls(file);
|
buildBaseUrls(file);
|
||||||
|
|
||||||
// TODO remove workaround in beta 5
|
|
||||||
if (file.rest.nameSpace.match("(.*)/api/?$") !== null) {
|
|
||||||
file.rest.nameSpace = getNameSpace(file.rest.nameSpace);
|
|
||||||
console.log(colors.white.bgMagenta.bold(`The rest.nameSpace property in your environment file or in your DSPACE_REST_NAMESPACE environment variable ends with '/api'.\nThis is deprecated. As '/api' isn't configurable on the rest side, it shouldn't be repeated in every environment file.\nPlease change the rest nameSpace to '${file.rest.nameSpace}'`));
|
|
||||||
}
|
|
||||||
|
|
||||||
const contents = `export const environment = ` + JSON.stringify(file);
|
const contents = `export const environment = ` + JSON.stringify(file);
|
||||||
writeFile(targetPath, contents, (err) => {
|
writeFile(targetPath, contents, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -119,16 +112,5 @@ function getPort(port: number): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNameSpace(nameSpace: string): string {
|
function getNameSpace(nameSpace: string): string {
|
||||||
// TODO remove workaround in beta 5
|
|
||||||
const apiMatches = nameSpace.match("(.*)/api/?$");
|
|
||||||
if (apiMatches != null) {
|
|
||||||
let newValue = '/'
|
|
||||||
if (hasValue(apiMatches[1])) {
|
|
||||||
newValue = apiMatches[1];
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nameSpace ? nameSpace.charAt(0) === '/' ? nameSpace : '/' + nameSpace : '';
|
return nameSpace ? nameSpace.charAt(0) === '/' ? nameSpace : '/' + nameSpace : '';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user