Skip to content

Commit 90a12a3

Browse files
committed
refactor(common): implement same empty values check for the library solidity
1 parent 26fde36 commit 90a12a3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

library-solidity/tasks/utils/loadVariables.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ import path from 'path';
55
const ADDRESSES_DIR = path.resolve(__dirname, '../../fhevmTemp/addresses');
66
const HOST_ADDRESSES_ENV_FILE_NAME = '.env.host';
77

8-
// Get the required environment variable, throw an error if it's not set
9-
// We only check if the variable is set, not if it's empty
8+
// Get the required environment variable, throw an error if it's not set or empty
109
export function getRequiredEnvVar(name: string): string {
1110
if (!(name in process.env)) {
1211
throw new Error(`"${name}" env variable is not set`);
1312
}
14-
return process.env[name]!;
13+
const value = process.env[name]!;
14+
if (value.trim() === '') {
15+
throw new Error(`"${name}" env variable is set but empty`);
16+
}
17+
return value;
1518
}
1619

1720
// Load the addresses as environment variables from the env file

0 commit comments

Comments
 (0)