17 lines
505 B
TypeScript
17 lines
505 B
TypeScript
|
/* eslint-disable no-process-env */
|
||
|
import { OptionProcess } from '../Types';
|
||
|
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 ();
|
||
|
}));
|
||
|
}
|
||
|
}
|