Skip to content

feat: Add approval required option #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ The configuration is saved to `lldebugger.config.ts`.

```
-V, --version output the version number
-r, --remove [option] Remove Lambda Live Debugger infrastructure. Options: 'keep-layer' (default), 'remove-all'. The latest also removes the Lambda Layer
-r, --remove [option] Remove Lambda Live Debugger infrastructure. Options: 'keep-layer' (default), 'all'. The latest also removes the Lambda Layer
-w, --wizard Program interactively asks for each parameter and saves it to lldebugger.config.ts
-v, --verbose Verbose logging
-c, --context <context> AWS CDK context (default: [])
Expand All @@ -110,6 +110,7 @@ The configuration is saved to `lldebugger.config.ts`.
-m, --subfolder <subfolder> Monorepo subfolder
-o, --observable Observability mode
-i --interval <interval> Observability mode interval (default: "3000")
-a --approval User approval required for AWS infrastructure changes, like adding a Lambda layer
--config-env <evironment> SAM environment
--sam-config-file <file> SAM configuration file
--sam-template-file <file> SAM template file
Expand Down
6 changes: 5 additions & 1 deletion src/configuration/getConfigFromCliArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function getConfigFromCliArgs(
program.name('lld').description('Lambda Live Debugger').version(version);
program.option(
'-r, --remove [option]',
"Remove Lambda Live Debugger infrastructure. Options: 'keep-layer' (default), 'remove-all'. The latest also removes the Lambda Layer",
"Remove Lambda Live Debugger infrastructure. Options: 'keep-layer' (default), 'all'. The latest also removes the Lambda Layer",
//validateRemoveOption,
//"keep-layer"
);
Expand All @@ -47,6 +47,10 @@ export async function getConfigFromCliArgs(
'Observability mode interval',
defaultObservableInterval.toString(),
);
program.option(
'-a, --approval',
'User approval required for AWS infrastructure changes, like adding a Lambda layer',
);
program.option('--config-env <evironment>', 'SAM environment');
program.option('--sam-config-file <file>', 'SAM configuration file');
program.option('--sam-template-file <file>', 'SAM template file');
Expand Down
16 changes: 16 additions & 0 deletions src/configuration/getConfigFromWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ export async function getConfigFromWizard({
};
}

// do you want to manually approve AWS infrastructure changes?
const answersApproval = await inquirer.prompt([
{
type: 'confirm',
name: 'approval',
message:
'Before debugging, do you want to review and manually approve AWS infrastructure changes, like adding a Lambda layer?',
default: currentConfig?.approval === true,
},
]);

answers = { ...answers, ...answersApproval };

const answersAws = await inquirer.prompt([
{
type: 'input',
Expand Down Expand Up @@ -388,6 +401,8 @@ export default {
observable: ${config.observable},
// Observable mode interval
interval: ${config.interval === defaultObservableInterval ? undefined : config.interval},
// Approval required for AWS infrastructure changes
approval: ${config.approval},
// Verbose logging
verbose: ${config.verbose},
// Modify Lambda function list or support custom framework
Expand Down Expand Up @@ -434,6 +449,7 @@ function getConfigFromAnswers(answers: any): LldConfigCliArgs {
answers.interval !== undefined
? answers.interval
: defaultObservableInterval,
approval: answers.approval,
verbose: answers.verbose,
interactive: answers.interactive,
gitignore: answers.gitignore,
Expand Down
Loading