@@ -129,17 +129,21 @@ const loadConfig = () => {
129129 // Load config.js and catch errors if not accessible
130130 try {
131131 let configContent = fs . readFileSync ( configFilename , "utf-8" ) ;
132+ const hideConfigSecrets = configContent . match ( / ^ \s * h i d e C o n f i g S e c r e t s : t r u e .* $ / m) ;
132133 let configContentFull = configContent ;
133- let configContentRedacted = configContent ;
134+ let configContentRedacted = hideConfigSecrets ? configContent : undefined ;
134135 Object . keys ( process . env ) . forEach ( ( env ) => {
135136 configContentFull = configContentFull . replaceAll ( `\${${ env } }` , process . env [ env ] ) ;
136- if ( env . startsWith ( "SECRET_" ) ) {
137- configContentRedacted = configContentRedacted . replaceAll ( `"\${${ env } }"` , `"**${ env } **"` ) ;
138- configContentRedacted = configContentRedacted . replaceAll ( `\${${ env } }` , `"**${ env } **"` ) ;
139- } else {
140- configContentRedacted = configContentRedacted . replaceAll ( `\${${ env } }` , process . env [ env ] ) ;
137+ if ( hideConfigSecrets ) {
138+ if ( env . startsWith ( "SECRET_" ) ) {
139+ configContentRedacted = configContentRedacted . replaceAll ( `"\${${ env } }"` , `"**${ env } **"` ) ;
140+ configContentRedacted = configContentRedacted . replaceAll ( `\${${ env } }` , `**${ env } **` ) ;
141+ } else {
142+ configContentRedacted = configContentRedacted . replaceAll ( `\${${ env } }` , process . env [ env ] ) ;
143+ }
141144 }
142145 } ) ;
146+ configContentRedacted = configContentRedacted ? configContentRedacted : configContentFull ;
143147 const configObj = {
144148 configFilename : configFilename ,
145149 configContentFull : configContentFull ,
0 commit comments