-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathdebug-env-variables.js
More file actions
executable file
·47 lines (40 loc) · 1.1 KB
/
debug-env-variables.js
File metadata and controls
executable file
·47 lines (40 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
import { styleText } from 'util';
const usedVariables = [
'ALLOW_SEARCH_INDEXING',
'GITHUB_USER_TOKEN',
'GITHUB_BROKEN_LINKS_ISSUE_NUMBER',
'NODE_ENV',
'PORT',
'HOST',
'WEBSITE_URL',
'GITHUB_PR_NUMBER',
'GITHUB_PR_HEAD_REF',
'GITHUB_PR_BASE_REF',
'GITHUB_REPOSITORY',
'GITHUB_RUN_ID',
'GITHUB_REF',
];
console.log('This scripts lists all environment variables that are used in the Open Fixture Library.\n');
console.log('Process environment variables:');
printVariables();
console.log();
await import('../lib/load-env-file.js');
console.log('Environment variables after reading .env:');
printVariables();
/**
* Prints all used environment variables and their values / unset
*/
function printVariables() {
for (const key of usedVariables) {
const coloredKey = styleText('yellow', key);
if (key in process.env) {
const coloredValue = styleText('green', process.env[key]);
console.log(`${coloredKey}=${coloredValue}`);
}
else {
const unsetLabel = styleText('red', ' is unset');
console.log(`${coloredKey}${unsetLabel}`);
}
}
}