2020-05-09 19:51:43 +02:00
|
|
|
/* eslint-disable no-process-env */
|
2020-05-09 21:30:37 +02:00
|
|
|
import { OptionProcess } from '../Option';
|
2020-05-09 19:51:43 +02:00
|
|
|
import { OptionSource } from './OptionSource';
|
|
|
|
|
|
|
|
export class EnvSource extends OptionSource {
|
|
|
|
public async parse (options: OptionProcess[]): Promise<void> {
|
|
|
|
await Promise.all (options.map ((opt) => {
|
|
|
|
if (
|
|
|
|
typeof opt.env !== 'undefined'
|
|
|
|
&& typeof process.env[opt.env] !== 'undefined'
|
|
|
|
)
|
|
|
|
return this.assign_arg (opt, process.env[opt.env]);
|
|
|
|
return Promise.resolve ();
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|