Skip to content

Commit

Permalink
Bref init: simplify condition
Browse files Browse the repository at this point in the history
  • Loading branch information
vdechenaux committed Oct 7, 2018
1 parent ac1aea2 commit 496a990
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions bref
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,19 @@ $app->command('init', function (SymfonyStyle $io) {
return 1;
}

$configured = true;
if (getenv('AWS_ACCESS_KEY_ID') === false || getenv('AWS_SECRET_ACCESS_KEY') === false) {
// Credentials are not configured with environment variables, check aws cli
if ($exeFinder->find('aws') !== null) {
$awsProcess = new Process('aws configure get aws_access_key_id && aws configure get aws_secret_access_key');
if ($awsProcess->run() !== 0) {
$configured = false;
}
} else {
$configured = false;
$awsProcess = new Process('aws configure get aws_access_key_id && aws configure get aws_secret_access_key');
if ($awsProcess->run() !== 0) {
$io->error([
'AWS credentials not found.',
'Please follow the instructions on https://github.com/mnapoli/bref#setup',
]);

return 1;
}
}

if (!$configured) {
$io->error(
'AWS credentials not found.'.PHP_EOL.
'Please follow the instructions on https://github.com/mnapoli/bref#setup'
);

return 1;
}

$fs = new Filesystem;
/*
* TODO Ask for a project name and configure it in `serverless.yml`.
Expand Down

0 comments on commit 496a990

Please sign in to comment.