File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " css-var-extract " : minor
3
+ ---
4
+
5
+ Support ` CVE_CONFIG ` environment variable
Original file line number Diff line number Diff line change @@ -200,7 +200,17 @@ cve watch
200
200
You can create ` cve.config.json ` and change settings.
201
201
If you are using a plugin, it also supports inline configuration.
202
202
203
- ### cve.config.json
203
+ You can also override the settings by the ` CVE_CONFIG ` environment variable.
204
+
205
+ ### Priority
206
+
207
+ The lower the number, the higher the priority.
208
+
209
+ 1 . Environment variable: ` CVE_CONFIG `
210
+ 2 . Inline config
211
+ 3 . File config ` cve.config.json `
212
+
213
+ ### JSON
204
214
205
215
``` json
206
216
{
Original file line number Diff line number Diff line change @@ -34,15 +34,21 @@ export const getConfig = (
34
34
"cve.config.json" ,
35
35
) ;
36
36
const exists = fs . existsSync ( configFilePathJson ) ;
37
+ const env = process . env . CVE_CONFIG ;
38
+ const envConfig = env ? JSON . parse ( env ) : { } ;
37
39
38
40
let config : Config ;
39
41
if ( exists ) {
40
42
config = configSchema . parse ( {
41
43
...JSON . parse ( fs . readFileSync ( configFilePathJson , "utf-8" ) ) ,
42
44
...inlineConfig ,
45
+ ...envConfig ,
43
46
} ) ;
44
47
} else {
45
- config = configSchema . parse ( inlineConfig ) ;
48
+ config = configSchema . parse ( {
49
+ ...inlineConfig ,
50
+ ...envConfig ,
51
+ } ) ;
46
52
if ( ! noCreate ) {
47
53
fs . writeFileSync (
48
54
configFilePathJson ,
You can’t perform that action at this time.
0 commit comments