Skip to content

Commit 0edbad6

Browse files
committed
remove direct process.env access, replacing with getEnv helper
1 parent 1593c85 commit 0edbad6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/workos.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { Actions } from './actions/actions';
3636
import { Vault } from './vault/vault';
3737
import { ConflictException } from './common/exceptions/conflict.exception';
3838
import { CryptoProvider } from './common/crypto/crypto-provider';
39+
import { getEnv } from './common/utils/env';
3940

4041
const VERSION = '8.0.0-beta.2';
4142

@@ -72,10 +73,7 @@ export class WorkOS {
7273
) {
7374
if (!key) {
7475
// process might be undefined in some environments
75-
this.key =
76-
typeof process !== 'undefined'
77-
? process?.env.WORKOS_API_KEY
78-
: undefined;
76+
this.key = getEnv('WORKOS_API_KEY');
7977

8078
if (!this.key) {
8179
throw new NoApiKeyProvidedException();
@@ -87,8 +85,8 @@ export class WorkOS {
8785
}
8886

8987
this.clientId = this.options.clientId;
90-
if (!this.clientId && typeof process !== 'undefined') {
91-
this.clientId = process?.env.WORKOS_CLIENT_ID;
88+
if (!this.clientId) {
89+
this.clientId = getEnv('WORKOS_CLIENT_ID');
9290
}
9391

9492
const protocol: string = this.options.https ? 'https' : 'http';

0 commit comments

Comments
 (0)