Skip to content

Commit 18c8190

Browse files
committed
refactor(common): implement same empty values check for the library solidity
1 parent ac6fed9 commit 18c8190

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
// Get the required environment variable, throw an error if it's not set
2-
// We only check if the variable is set, not if it's empty
1+
// Get the required environment variable, throw an error if it's not set or empty
32
export function getRequiredEnvVar(name: string): string {
43
if (!(name in process.env)) {
54
throw new Error(`"${name}" env variable is not set`);
65
}
7-
return process.env[name]!;
6+
const value = process.env[name]!;
7+
if (value.trim() === '') {
8+
throw new Error(`"${name}" env variable is set but empty`);
9+
}
10+
return value;
811
}

0 commit comments

Comments
 (0)