MCPcopy
hub / github.com/mozilla/web-ext / cleanupProcessEnvConfigs

Method cleanupProcessEnvConfigs

src/program.js:217–237  ·  view source on GitHub ↗
(systemProcess)

Source from the content-addressed store, hash-verified

215 // Remove WEB_EXT_* environment vars that are not a global cli options
216 // or an option supported by the current command (See #793).
217 cleanupProcessEnvConfigs(systemProcess) {
218 const cmd = yargsParser(this.programArgv)._[0];
219 const env = systemProcess.env || {};
220 const toOptionKey = (k) =>
221 decamelize(camelCase(k.replace(envPrefix, '')), { separator: '-' });
222
223 if (cmd) {
224 Object.keys(env)
225 .filter((k) => k.startsWith(envPrefix))
226 .forEach((k) => {
227 const optKey = toOptionKey(k);
228 const globalOpt = this.options[optKey];
229 const cmdOpt = this.options[cmd] && this.options[cmd][optKey];
230
231 if (!globalOpt && !cmdOpt) {
232 log.debug(`Environment ${k} not supported by web-ext ${cmd}`);
233 delete env[k];
234 }
235 });
236 }
237 }
238
239 async execute({
240 checkForUpdates = defaultUpdateChecker,

Callers 2

executeMethod · 0.95
test.program.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected