From 496a990277c5778dc927b6be107b70c63d8f1959 Mon Sep 17 00:00:00 2001 From: Vincent Dechenaux Date: Sun, 7 Oct 2018 11:32:43 +0200 Subject: [PATCH] Bref init: simplify condition --- bref | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/bref b/bref index cf8d4b293..58e1a29e7 100755 --- a/bref +++ b/bref @@ -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`.