diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ece0ffd47e..fb45f6b2fe 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -44,10 +44,19 @@ export class AppModule { private initializeApp() { environment.BASE_URL = this.getCurrentDomain() + environment.API_WEB = environment.API_WEB.replace( + '', + this.getSubDomain() + ) } getCurrentDomain() { const port = window.location.port ? ':' + window.location.port : '' return '//' + window.location.hostname + port + '/' } + + getSubDomain() { + const subdomain = window.location.hostname.split('.').slice(0, -2).join('.') + return subdomain ? subdomain + '.' : '' + } } diff --git a/src/environments/environment.int.ts b/src/environments/environment.int.ts index c29298cefd..0da1a008e7 100644 --- a/src/environments/environment.int.ts +++ b/src/environments/environment.int.ts @@ -5,8 +5,8 @@ export const environment = { debugger: true, ROBOTS: 'noindex, nofollow', API_NEWS: 'https://info.int.orcid.org/feed/', - API_PUB: `//pub.${getSubDomain()}orcid.org/v3.0`, - API_WEB: `//${getSubDomain()}orcid.org/`, + API_PUB: `//pub.orcid.org/v3.0`, + API_WEB: `//orcid.org/`, BASE_URL: '', INFO_SITE: 'https://info.qa.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, diff --git a/src/environments/environment.local-with-proxy.ts b/src/environments/environment.local-with-proxy.ts index bfcf39d179..1475d7062b 100644 --- a/src/environments/environment.local-with-proxy.ts +++ b/src/environments/environment.local-with-proxy.ts @@ -1,12 +1,10 @@ -import { getSubDomain } from "./subdomain.adapter"; - export const environment = { production: false, debugger: true, ROBOTS: 'all', API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', - API_PUB: `//${getSubDomain()}localhost:4200/v3.0`, - API_WEB: `//${getSubDomain()}localhost:4200/`, + API_PUB: `//localhost:4200/v3.0`, + API_WEB: `//localhost:4200/`, BASE_URL: '', INFO_SITE: 'https://info.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index 17a2c48d44..238734638a 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -1,12 +1,10 @@ -import { getSubDomain } from "./subdomain.adapter"; - export const environment = { production: false, debugger: true, ROBOTS: 'all', API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8', - API_PUB: `//pub.${getSubDomain()}orcid.org/v3.0`, - API_WEB: `//${getSubDomain()}orcid.org/`, + API_PUB: `//pub.orcid.org/v3.0`, + API_WEB: `//orcid.org/`, BASE_URL: '', INFO_SITE: 'https://info.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index 875cc1bcb6..aabd4682cb 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -1,12 +1,10 @@ -import { getSubDomain } from "./subdomain.adapter"; - export const environment = { production: true, debugger: false, ROBOTS: 'all', API_NEWS: 'https://info.orcid.org/feed/', - API_PUB: `//pub.${getSubDomain()}orcid.org/v3.0`, - API_WEB: `//${getSubDomain()}orcid.org/`, + API_PUB: `//pub.orcid.org/v3.0`, + API_WEB: `//orcid.org/`, BASE_URL: '', INFO_SITE: 'https://info.orcid.org/', SHOW_TEST_WARNING_BANNER: false, diff --git a/src/environments/environment.qa.ts b/src/environments/environment.qa.ts index 738924ed73..3cfb8762b8 100644 --- a/src/environments/environment.qa.ts +++ b/src/environments/environment.qa.ts @@ -1,12 +1,10 @@ -import { getSubDomain } from "./subdomain.adapter"; - export const environment = { production: true, debugger: true, ROBOTS: 'noindex, nofollow', API_NEWS: 'https://info.qa.orcid.org/feed/', - API_PUB: `//pub.${getSubDomain()}orcid.org/v3.0`, - API_WEB: `//${getSubDomain()}orcid.org/`, + API_PUB: `//pub.orcid.org/v3.0`, + API_WEB: `//orcid.org/`, BASE_URL: '', INFO_SITE: 'https://info.qa.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: true, diff --git a/src/environments/environment.sandbox.ts b/src/environments/environment.sandbox.ts index 209db30d39..c82224ebda 100644 --- a/src/environments/environment.sandbox.ts +++ b/src/environments/environment.sandbox.ts @@ -1,12 +1,10 @@ -import { getSubDomain } from "./subdomain.adapter"; - export const environment = { production: true, debugger: false, ROBOTS: 'noindex, nofollow', API_NEWS: 'https://info.qa.orcid.org/feed/', - API_PUB: `//pub.${getSubDomain()}orcid.org/v3.0`, - API_WEB: `//${getSubDomain()}orcid.org/`, + API_PUB: `//pub.orcid.org/v3.0`, + API_WEB: `//orcid.org/`, BASE_URL: '', INFO_SITE: 'https://info.qa.orcid.org/', GOOGLE_ANALYTICS_TESTING_MODE: false, diff --git a/src/environments/subdomain.adapter.ts b/src/environments/subdomain.adapter.ts deleted file mode 100644 index 6dac065eee..0000000000 --- a/src/environments/subdomain.adapter.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function getSubDomain() { - const subdomain = window.location.hostname.split('.').slice(0, -2).join('.'); - return subdomain? subdomain+'.':'' -}