Skip to content

Commit f790bf9

Browse files
committed
add ability to check env
1 parent d60813e commit f790bf9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// The GraphQL.js version info.
3030
export { version, versionInfo } from './version.js';
31-
export { setEnv } from './setEnv.js';
31+
export { setEnv, getEnv } from './setEnv.js';
3232
export type { Env } from './setEnv.js';
3333

3434
// The primary entry point into fulfilling a GraphQL request.

src/setEnv.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import { setInstanceOfCheckForEnv } from './jsutils/instanceOf.js';
22

33
export type Env = 'production' | 'development';
44

5+
let env: Env | undefined;
6+
57
export function setEnv(newEnv: Env): void {
8+
env = newEnv;
69
setInstanceOfCheckForEnv(newEnv);
710
}
11+
12+
export function getEnv(): Env | undefined {
13+
return env;
14+
}

0 commit comments

Comments
 (0)