74615: Remove workaround for baseUrl ending in /api

This commit is contained in:
Yana De Pauw
2020-11-17 15:38:30 +01:00
parent 2ee815908f
commit 77ca0f049a

View File

@@ -54,13 +54,6 @@ import(environmentFilePath)
function generateEnvironmentFile(file: GlobalConfig): void {
file.production = production;
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);
writeFile(targetPath, contents, (err) => {
if (err) {
@@ -119,16 +112,5 @@ function getPort(port: number): 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 : '';
}