diff --git a/app/Commands/AwsAssumeRole.php b/app/Commands/AwsAssumeRole.php index 3e174b5..20a1960 100644 --- a/app/Commands/AwsAssumeRole.php +++ b/app/Commands/AwsAssumeRole.php @@ -92,7 +92,7 @@ public function handle() $this->info("Now opening a session following you ({$sessionUser}) assuming the role {$role} on {$accountName} ({$accountId}) . Type `exit` to leave this shell."); - (new Process([config('app.shell')])) + (new Process([env('SHELL', 'bash')])) ->setEnv(array_merge($envVars, [ 'AWS_S3_ENV' => $account['s3env'], 'BASH_SILENCE_DEPRECATION_WARNING' => '1', diff --git a/app/Commands/AwsMfaLogin.php b/app/Commands/AwsMfaLogin.php index 541b244..3bbed52 100644 --- a/app/Commands/AwsMfaLogin.php +++ b/app/Commands/AwsMfaLogin.php @@ -57,7 +57,7 @@ public function handle() $this->info("Now opening a session following your MFA authentication. Type `exit` to leave this shell."); - (new Process([config('app.shell')])) + (new Process([env('SHELL', 'bash')])) ->setEnv(array_merge($envVars, [ 'BASH_SILENCE_DEPRECATION_WARNING' => '1', 'PS1' => "\e[32mnscli\e[34m(mfa-authd)$\e[39m ", diff --git a/app/Commands/EditEnvironmentVariables.php b/app/Commands/EditEnvironmentVariables.php index 1e89601..dfaeaf4 100644 --- a/app/Commands/EditEnvironmentVariables.php +++ b/app/Commands/EditEnvironmentVariables.php @@ -36,6 +36,8 @@ class EditEnvironmentVariables extends BaseCommand private string $fileContents; + private string $editor; + public function configure() { $this->setDefinition(array_merge([ @@ -50,7 +52,9 @@ public function configure() */ public function handle() { - $requiredBinaries = ['aws', config('app.editor')]; + $this->editor = env('EDITOR', '/usr/bin/vi'); + + $requiredBinaries = ['aws', $this->editor]; if ($this->helpers->checks()->checkAndReportMissingBinaries($requiredBinaries)) { exit(1); @@ -143,7 +147,7 @@ private function editFile(): string case -1: die('Unable to run editor'); case 0: - pcntl_exec(config('app.editor'), ['/tmp/' . $this->fileName]); + pcntl_exec($this->editor, ['/tmp/' . $this->fileName]); break; default: pcntl_waitpid($pid, $status); diff --git a/config/app.php b/config/app.php index 2a04f31..4ce73b7 100644 --- a/config/app.php +++ b/config/app.php @@ -56,7 +56,4 @@ 'providers' => [ App\Providers\AppServiceProvider::class, ], - - 'editor' => env('EDITOR', '/usr/bin/vi'), - 'shell' => env('SHELL', 'bash') ];