Skip to content

Commit f48a6cf

Browse files
authored
refactor: check EL_RPC_URLS_* only from SUPPORTED_CHAINS
* refactor: check EL_RPC_URLS_* only from SUPPORTED_CHAINS * fix: no logEnvironmentVariables check for build-time * feat: remove process.exit(1)
1 parent 76d08da commit f48a6cf

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

scripts/log-environment-variables.mjs

+20-4
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export const openKeys = [
3030
export const secretKeys = [
3131
'EL_RPC_URLS_1',
3232
'EL_RPC_URLS_5',
33+
'EL_RPC_URLS_10',
34+
'EL_RPC_URLS_1868',
35+
'EL_RPC_URLS_1946',
3336
'EL_RPC_URLS_17000',
3437
'EL_RPC_URLS_11155111',
35-
'EL_RPC_URLS_10',
3638
'EL_RPC_URLS_11155420',
37-
'EL_RPC_URLS_1868',
38-
'EL_RPC_URLS_1946'
3939
];
4040

4141
export const logOpenEnvironmentVariables = () => {
@@ -61,8 +61,24 @@ export const logSecretEnvironmentVariables = () => {
6161
console.log('Log secret environment variables:');
6262
console.log('---------------------------------------------');
6363

64-
// console.log('process.env:', process.env)
64+
if (!process.env['SUPPORTED_CHAINS']) {
65+
console.warn('SUPPORTED_CHAINS is not defined in process.env!');
66+
console.warn('Skip the logSecretEnvironmentVariables check!');
67+
return;
68+
}
69+
70+
const supportedChains = process.env['SUPPORTED_CHAINS'].split(',').map(s => s.trim());
71+
6572
for (const key of secretKeys) {
73+
if (key.startsWith('EL_RPC_URLS_')) {
74+
const chainId = key.replace('EL_RPC_URLS_', '');
75+
if (!supportedChains.includes(chainId)) {
76+
console.info(`Secret ${key} - skipped (${chainId} isn't in the SUPPORTED_CHAINS)!`);
77+
// Skip check if chainId isn't in the SUPPORTED_CHAINS
78+
continue;
79+
}
80+
}
81+
6682
if (!process.env.hasOwnProperty(key)) {
6783
console.error(`Secret ${key} - ERROR (not exist in process.env)`);
6884
continue;

0 commit comments

Comments
 (0)