Skip to content

Commit

Permalink
Merge pull request #116 from taggit-tacc/task/WG-160-add-dev-server-t…
Browse files Browse the repository at this point in the history
…o-taggit

Add /taggit-dev support
  • Loading branch information
nathanfranklin authored Oct 4, 2023
2 parents 8c31118 + ca682ed commit 3080fd1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/app/services/env.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ export class EnvService {

private getHazmapperUrl(backend: EnvironmentType): string {
if (backend === EnvironmentType.Local) {
return 'https://hazmapper.tacc.utexas.edu/hazmapper';
return 'http://localhost:4200/';
} else if (backend === EnvironmentType.Staging) {
return 'https://hazmapper.tacc.utexas.edu/staging';
} else if (backend === EnvironmentType.Dev) {
return 'https://hazmapper.tacc.utexas.edu/dev';
} else if (backend === EnvironmentType.Production) {
return 'https://hazmapper.tacc.utexas.edu/hazmapper';
} else {
Expand All @@ -33,6 +35,8 @@ export class EnvService {
return 'https://agave.designsafe-ci.org/geo-staging/v2';
} else if (backend === EnvironmentType.Production) {
return 'https://agave.designsafe-ci.org/geo/v2';
} else if (backend === EnvironmentType.Dev) {
return 'https://agave.designsafe-ci.org/geo-dev/v2';
} else {
throw new Error('Unsupported Type');
}
Expand Down Expand Up @@ -106,6 +110,13 @@ export class EnvService {
}
this._baseHref = '/';
this._clientId = 'RMCJHgW9CwJ6mKjhLTDnUYBo9Hka';
} else if (/^hazmapper.tacc.utexas.edu/.test(hostname) && pathname.startsWith('/taggit-dev')) {
this._env = EnvironmentType.Dev;
this._apiUrl = this.getApiUrl(this.env);
this._portalUrl = this.getPortalUrl(this.env);
this._hazmapperUrl = this.getHazmapperUrl(this.env);
this._clientId = '2rSCfaGy7TIg2jLLZCfI0vhLREoa';
this._baseHref = '/taggit-dev/';
} else if (/^hazmapper.tacc.utexas.edu/.test(hostname) && pathname.startsWith('/taggit-staging')) {
this._env = EnvironmentType.Staging;
this._apiUrl = this.getApiUrl(this.env);
Expand Down
1 change: 1 addition & 0 deletions src/environments/environmentType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum EnvironmentType {
Production = 'production',
Staging = 'staging',
Dev = 'dev',
Local = 'local',
}
4 changes: 3 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
var hostname = window.location.hostname;
var pathname = window.location.pathname;

if (/^hazmapper.tacc.utexas.edu/.test(hostname) && pathname.startsWith('/taggit-staging')) {
if (/^hazmapper.tacc.utexas.edu/.test(hostname) && pathname.startsWith('/taggit-dev')) {
document.getElementById('base').href = '/taggit-dev/';
} else if (/^hazmapper.tacc.utexas.edu/.test(hostname) && pathname.startsWith('/taggit-staging')) {
document.getElementById('base').href = '/taggit-staging/';
} else if (/^hazmapper.tacc.utexas.edu/.test(hostname)) {
document.getElementById('base').href = '/taggit/';
Expand Down

0 comments on commit 3080fd1

Please sign in to comment.