Skip to content

Commit

Permalink
[SM-891] Set SM flag to true for self-hosted (#6088)
Browse files Browse the repository at this point in the history
* Set SM flag to true for selfhosted

* [SM-890] Add Secrets Manager self-hosted indicator (#6163)

* Add SM self-hosted indicator
  • Loading branch information
Thomas-Avery authored Oct 16, 2023
1 parent c39ffe1 commit d79ef47
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/web/config/selfhosted.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"port": 8081
},
"flags": {
"secretsManager": false,
"secretsManager": true,
"showPasswordless": true,
"enableCipherKeyEncryption": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
</div>
</div>

<ng-container *ngIf="selfHosted">
<bit-menu-divider></bit-menu-divider>
<span class="tw-break-all tw-px-4 tw-py-1 tw-text-left tw-text-muted">
{{ hostname }}
</span>
</ng-container>

<bit-menu-divider></bit-menu-divider>

<a bitMenuItem routerLink="/settings/account">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { combineLatest, map, Observable } from "rxjs";
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
import { VaultTimeoutAction } from "@bitwarden/common/enums/vault-timeout-action.enum";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { AccountProfile } from "@bitwarden/common/platform/models/domain/account";

Expand All @@ -26,10 +27,13 @@ export class HeaderComponent {
protected routeData$: Observable<{ titleId: string }>;
protected account$: Observable<AccountProfile>;
protected canLock$: Observable<boolean>;
protected selfHosted: boolean;
protected hostname = location.hostname;

constructor(
private route: ActivatedRoute,
private stateService: StateService,
private platformUtilsService: PlatformUtilsService,
private vaultTimeoutSettingsService: VaultTimeoutSettingsService,
private messagingService: MessagingService
) {
Expand All @@ -41,6 +45,8 @@ export class HeaderComponent {
})
);

this.selfHosted = this.platformUtilsService.isSelfHost();

this.account$ = combineLatest([
this.stateService.activeAccount$,
this.stateService.accounts$,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { JslibModule } from "@bitwarden/angular/jslib.module";
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
import { VaultTimeoutAction } from "@bitwarden/common/enums/vault-timeout-action.enum";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import {
AvatarModule,
Expand Down Expand Up @@ -50,6 +51,12 @@ class MockVaultTimeoutService {
}
}

class MockPlatformUtilsService {
isSelfHost() {
return false;
}
}

@Component({
selector: "product-switcher",
template: `<button bitIconButton="bwi-filter"></button>`,
Expand Down Expand Up @@ -97,6 +104,7 @@ export default {
declarations: [HeaderComponent, MockProductSwitcher, MockDynamicAvatar],
providers: [
{ provide: StateService, useClass: MockStateService },
{ provide: PlatformUtilsService, useClass: MockPlatformUtilsService },
{ provide: VaultTimeoutSettingsService, useClass: MockVaultTimeoutService },
{
provide: MessagingService,
Expand Down

0 comments on commit d79ef47

Please sign in to comment.