Skip to content

Commit

Permalink
calculate all domains and subdomains on runtime:
Browse files Browse the repository at this point in the history
  • Loading branch information
leomendoza123 committed Oct 24, 2023
1 parent 731dd49 commit be63032
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 22 deletions.
17 changes: 14 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,27 @@ export class AppModule {
}

private initializeApp() {
environment.BASE_URL = this.getCurrentDomain()
environment.API_WEB = environment.API_WEB.replace(
'<SUBDOMAIN>',
this.getSubDomain()
)
environment.BASE_URL = environment.BASE_URL.replace(
'<SUBDOMAIN>',
this.getSubDomain()
)
environment.API_WEB = environment.API_WEB.replace(
'<DOMAIN>',
this.getCurrentLeanDomain()
)
environment.BASE_URL = environment.BASE_URL.replace(
'<DOMAIN>',
this.getCurrentLeanDomain()
)
}

getCurrentDomain() {
getCurrentLeanDomain() {
const port = window.location.port ? ':' + window.location.port : ''
return '//' + window.location.hostname + port + '/'
return window.location.hostname.split('.').slice(-2).join('.') + port
}

getSubDomain() {
Expand Down
3 changes: 2 additions & 1 deletion src/app/cdk/platform-info/browserlist.regexp.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// tslint:disable-next-line: max-line-length
export const BROWSERLIST_REGEXP = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/
export const BROWSERLIST_REGEXP =
/((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(13[_.]4|13[_.]([5-9]|\d{2,})|13[_.]7|13[_.]([8-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})[_.]\d+|14[_.]0|14[_.]([1-9]|\d{2,})|14[_.]4|14[_.]([5-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+|16[_.]0|16[_.]([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|((?:Chrome).*OPR\/(74|(7[5-9]|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Edge\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))(?:\.\d+)?)|((Chromium|Chrome)\/(80|(8[1-9]|9\d|\d{3,})|83|(8[4-9]|9\d|\d{3,}))\.\d+(?:\.\d+)?)|(Version\/(13\.1|13\.([2-9]|\d{2,})|(1[4-9]|[2-9]\d|\d{3,})\.\d+|14\.0|14\.([1-9]|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})\.\d+|15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+|16\.0|16\.([1-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+\.\d+)|(Firefox\/(78|(79|[8-9]\d|\d{3,}))\.\d+(pre|[ab]\d+[a-z]*)?)/
2 changes: 1 addition & 1 deletion src/environments/environment.int.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getSubDomain } from "./subdomain.adapter";
import { getSubDomain } from './subdomain.adapter'

export const environment = {
production: true,
Expand Down
6 changes: 3 additions & 3 deletions src/environments/environment.local-with-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const environment = {
debugger: true,
ROBOTS: 'all',
API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8',
API_PUB: `//<SUBDOMAIN>localhost:4200/v3.0`,
API_WEB: `//<SUBDOMAIN>localhost:4200/`,
BASE_URL: '',
API_PUB: `//<SUBDOMAIN><DOMAIN>/v3.0`,
API_WEB: `//<SUBDOMAIN><DOMAIN>/`,
BASE_URL: '//<SUBDOMAIN><DOMAIN>/',
INFO_SITE: 'https://info.orcid.org/',
GOOGLE_ANALYTICS_TESTING_MODE: true,
GOOGLE_TAG_MANAGER: 'GTM-0000000',
Expand Down
6 changes: 3 additions & 3 deletions src/environments/environment.local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const environment = {
debugger: true,
ROBOTS: 'all',
API_NEWS: 'https://www.mocky.io/v2/5dced45b3000007300931ce8',
API_PUB: `//pub.<SUBDOMAIN>orcid.org/v3.0`,
API_WEB: `//<SUBDOMAIN>orcid.org/`,
BASE_URL: '',
API_PUB: `//pub.<SUBDOMAIN><DOMAIN>/v3.0`,
API_WEB: `//<SUBDOMAIN><DOMAIN>/`,
BASE_URL: '//<SUBDOMAIN><DOMAIN>/',
INFO_SITE: 'https://info.orcid.org/',
GOOGLE_ANALYTICS_TESTING_MODE: true,
GOOGLE_TAG_MANAGER: 'GTM-0000000',
Expand Down
8 changes: 3 additions & 5 deletions src/environments/environment.production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const environment = {
debugger: false,
ROBOTS: 'all',
API_NEWS: 'https://info.orcid.org/feed/',
API_PUB: `//pub.<SUBDOMAIN>orcid.org/v3.0`,
API_WEB: `//<SUBDOMAIN>orcid.org/`,
BASE_URL: '',
API_PUB: `//pub.<SUBDOMAIN><DOMAIN>/v3.0`,
API_WEB: `//<SUBDOMAIN><DOMAIN>/`,
BASE_URL: '//<SUBDOMAIN><DOMAIN>/',
INFO_SITE: 'https://info.orcid.org/',
SHOW_TEST_WARNING_BANNER: false,
GOOGLE_ANALYTICS_TESTING_MODE: false,
Expand Down Expand Up @@ -34,5 +34,3 @@ export const environment = {
},
proxyMode: false,
}


6 changes: 3 additions & 3 deletions src/environments/environment.qa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const environment = {
debugger: true,
ROBOTS: 'noindex, nofollow',
API_NEWS: 'https://info.qa.orcid.org/feed/',
API_PUB: `//pub.<SUBDOMAIN>orcid.org/v3.0`,
API_WEB: `//<SUBDOMAIN>orcid.org/`,
BASE_URL: '',
API_PUB: `//pub.<SUBDOMAIN><DOMAIN>/v3.0`,
API_WEB: `//<SUBDOMAIN><DOMAIN>/`,
BASE_URL: '//<SUBDOMAIN><DOMAIN>/',
INFO_SITE: 'https://info.qa.orcid.org/',
GOOGLE_ANALYTICS_TESTING_MODE: true,
GOOGLE_TAG_MANAGER: 'GTM-TRLHLRZ',
Expand Down
6 changes: 3 additions & 3 deletions src/environments/environment.sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const environment = {
debugger: false,
ROBOTS: 'noindex, nofollow',
API_NEWS: 'https://info.qa.orcid.org/feed/',
API_PUB: `//pub.<SUBDOMAIN>orcid.org/v3.0`,
API_WEB: `//<SUBDOMAIN>orcid.org/`,
BASE_URL: '',
API_PUB: `//pub.<SUBDOMAIN><DOMAIN>/v3.0`,
API_WEB: `//<SUBDOMAIN><DOMAIN>/`,
BASE_URL: '//<SUBDOMAIN><DOMAIN>/',
INFO_SITE: 'https://info.qa.orcid.org/',
GOOGLE_ANALYTICS_TESTING_MODE: false,
GOOGLE_TAG_MANAGER: 'GTM-M9Z7DHS',
Expand Down

0 comments on commit be63032

Please sign in to comment.