Skip to content

Commit d80a6c7

Browse files
committed
fix: improve instanceid api
1 parent dfe7aef commit d80a6c7

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export type { BaseEnv } from './schemas/env.schema.js';
3535
export { $MongoEnv } from './schemas/mongo-env.schema.js';
3636
export type { RequestUser } from './user-config.js';
3737
export type { BaseEnvSchema } from './utils/env.utils.js';
38-
export { getInstanceId } from './utils/env.utils.js';
38+
export { INSTANCE_ID } from './utils/env.utils.js';
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { describe, expect, it } from 'vitest';
22

3-
import { getInstanceId } from '../env.utils.js';
3+
import { INSTANCE_ID } from '../env.utils.js';
44

55
describe('getInstanceId', () => {
6-
it('should return a UUID in tests', () => {
7-
expect(getInstanceId()).toBeTypeOf('string');
6+
it('should be a UUID in tests', () => {
7+
expect(INSTANCE_ID).toBeTypeOf('string');
88
});
99
});

src/utils/env.utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import type { BaseEnv } from '../schemas/env.schema.js';
55

66
export type BaseEnvSchema = z.ZodType<BaseEnv>;
77

8-
export function getInstanceId(): string {
9-
return process.env.LIBNEST_INSTANCE_ID!;
10-
}
8+
export const INSTANCE_ID = process.env.LIBNEST_INSTANCE_ID!;
119

1210
export function parseEnv<TSchema extends BaseEnvSchema = BaseEnvSchema>(schema: TSchema): z.output<TSchema> {
1311
// this is required so that these can be statically replaced in the bundle

0 commit comments

Comments
 (0)