Skip to content

Commit

Permalink
Merge pull request #424 from j0k3r/feature/dashboard-aws-profile
Browse files Browse the repository at this point in the history
Add AWS profile option when using the dashboard
  • Loading branch information
mnapoli authored Aug 23, 2019
2 parents a9b5157 + 14af911 commit a0fc2fa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bref
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,11 @@ $app->command('deployment stack-name [--region=]', function (string $stackName,
return 0;
})->descriptions('Displays the latest deployment logs from CloudFormation. Only the logs from the last 24 hours are displayed. Use these logs to debug why a deployment failed.');

$app->command('dashboard [--host=] [--port=]', function (string $host = 'localhost', int $port = 8000, SymfonyStyle $io) {
$app->command('dashboard [--host=] [--port=] [--profile=]', function (string $host = 'localhost', int $port = 8000, string $profile = 'default', SymfonyStyle $io) {
if ($host === 'localhost') {
$host = '127.0.0.1';
}

if (! file_exists('serverless.yml')) {
$io->error('No `serverless.yml` file found.');

Expand All @@ -279,7 +280,7 @@ $app->command('dashboard [--host=] [--port=]', function (string $host = 'localho
return 1;
}

$servelessInfo = new Process(['serverless', 'info']);
$servelessInfo = new Process(['serverless', 'info', '--aws-profile', $profile]);
$servelessInfo->start();
$animation = new LoadingAnimation($io);
do {
Expand Down Expand Up @@ -323,7 +324,7 @@ $app->command('dashboard [--host=] [--port=]', function (string $host = 'localho
return 1;
}

$process = new Process(['docker', 'run', '--rm', '-p', $host . ':' . $port.':8000', '-v', getenv('HOME').'/.aws:/root/.aws:ro', '--env', 'STACKNAME='.$stack, '--env', 'REGION='.$region, 'bref/dashboard']);
$process = new Process(['docker', 'run', '--rm', '-p', $host . ':' . $port.':8000', '-v', getenv('HOME').'/.aws:/root/.aws:ro', '--env', 'STACKNAME='.$stack, '--env', 'REGION='.$region, '--env', 'AWS_PROFILE='.$profile, 'bref/dashboard']);
$process->setTimeout(null);
$process->start();
do {
Expand Down

0 comments on commit a0fc2fa

Please sign in to comment.