envilder
Version:
A CLI that securely centralizes your environment variables from AWS SSM as a single source of truth
26 lines • 1.02 kB
JavaScript
import { OperationMode } from '../../domain/OperationMode.js';
export class DispatchActionCommand {
constructor(map, envfile, key, value, ssmPath, profile, mode = OperationMode.PULL_SSM_TO_ENV) {
this.map = map;
this.envfile = envfile;
this.key = key;
this.value = value;
this.ssmPath = ssmPath;
this.profile = profile;
this.mode = mode;
}
static fromCliOptions(options) {
const mode = DispatchActionCommand.determineOperationMode(options);
return new DispatchActionCommand(options.map, options.envfile, options.key, options.value, options.ssmPath, options.profile, mode);
}
static determineOperationMode(options) {
if (options.key && options.value && options.ssmPath) {
return OperationMode.PUSH_SINGLE;
}
if (options.push) {
return OperationMode.PUSH_ENV_TO_SSM;
}
return OperationMode.PULL_SSM_TO_ENV;
}
}
//# sourceMappingURL=DispatchActionCommand.js.map