From 43090648048be2b803017baf0313ab628c950dd6 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Tue, 16 Jun 2020 09:35:25 -0500 Subject: [PATCH] [Enterprise] Added environment checks (#559) * Update jslib (2b6657a -> 28d21ca) * Environment variable checks --- jslib | 2 +- src/app/layouts/organization-layout.component.ts | 12 +++++++++++- src/app/services/services.module.ts | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/jslib b/jslib index 2b6657a293..28d21ca5df 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 2b6657a293e7be107271ad080c64ccd3f005afb7 +Subproject commit 28d21ca5dfacd1487cd92345d8be9554079fbd96 diff --git a/src/app/layouts/organization-layout.component.ts b/src/app/layouts/organization-layout.component.ts index 1f80788a9d..79abc291a5 100644 --- a/src/app/layouts/organization-layout.component.ts +++ b/src/app/layouts/organization-layout.component.ts @@ -9,6 +9,7 @@ import { ActivatedRoute } from '@angular/router'; import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; import { UserService } from 'jslib/abstractions/user.service'; +import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { Organization } from 'jslib/models/domain/organization'; @@ -22,11 +23,20 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy { organization: Organization; private organizationId: string; + private enterpriseUrl: string; constructor(private route: ActivatedRoute, private userService: UserService, - private broadcasterService: BroadcasterService, private ngZone: NgZone) { } + private broadcasterService: BroadcasterService, private environmentService: EnvironmentService, + private ngZone: NgZone) { } ngOnInit() { + this.enterpriseUrl = 'https://enterprise.bitwarden.com'; + if (this.environmentService.enterpriseUrl != null) { + this.enterpriseUrl = this.environmentService.enterpriseUrl; + } else if (this.environmentService.baseUrl != null) { + this.enterpriseUrl = this.environmentService.baseUrl + '/enterprise'; + } + document.body.classList.remove('layout_frontend'); this.route.params.subscribe(async (params) => { this.organizationId = params.organizationId; diff --git a/src/app/services/services.module.ts b/src/app/services/services.module.ts index c74261dd31..e64240ad87 100644 --- a/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts @@ -140,6 +140,8 @@ export function initFactory(): Function { } else { environmentService.notificationsUrl = isDev ? 'http://localhost:61840' : 'https://notifications.bitwarden.com'; // window.location.origin + '/notifications'; + environmentService.enterpriseUrl = isDev ? 'http://localhost:61840' : + 'https://enterprise.bitwarden.com'; // window.location.origin + '/enterprise'; } apiService.setUrls({ base: isDev ? null : window.location.origin,