diff options
author | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-10 17:31:06 -0700 |
---|---|---|
committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-10 18:13:23 -0700 |
commit | 3a06e32e2724bcc349bbbfa93c08c23a7c732ad4 (patch) | |
tree | b71504605a45e504cc31cc9ecc22a6346b149c32 /utils/secret.ts | |
parent | fa8f3f9465e87d499f7d6428323f496a884b7818 (diff) | |
download | ci-3a06e32e2724bcc349bbbfa93c08c23a7c732ad4.tar.gz ci-3a06e32e2724bcc349bbbfa93c08c23a7c732ad4.zip |
Flesh out ansible playbook job.
Diffstat (limited to 'utils/secret.ts')
-rw-r--r-- | utils/secret.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/secret.ts b/utils/secret.ts index 9847aa6..8860998 100644 --- a/utils/secret.ts +++ b/utils/secret.ts @@ -15,7 +15,7 @@ export class BitwardenSession { public async getItem<T extends LoginItem | SecureNote>( secretName: string, - ): Promise<T | undefined> { + ): Promise<T> { return await this.sessionInitializer.then((session) => getStdout(`bw list items`, { env: { @@ -24,7 +24,10 @@ export class BitwardenSession { }) ).then((items) => JSON.parse(items)).then((items) => items.find(({ name }: { name: string }) => name === secretName) - ); + ).then((item) => { + if (!item) throw new Error("Could not find bitwarden item " + secretName); + return item; + }); } async close(): Promise<void> { |