Skip to content

Commit

Permalink
Get the environment from config.yml if available (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovani authored and jmolivas committed Oct 28, 2017
1 parent 13f0132 commit 873a255
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,19 @@ private function registerEvents()
*/
private function addOptions()
{
// Get the configuration from config.yml.
$env = $this->container
->get('console.configuration_manager')
->getConfiguration()
->get('application.environment');

$this->getDefinition()->addOption(
new InputOption(
'--env',
'-e',
InputOption::VALUE_OPTIONAL,
$this->trans('application.options.env'), 'prod'
$this->trans('application.options.env'),
!empty($env) ? $env : 'prod'
)
);
$this->getDefinition()->addOption(
Expand Down

0 comments on commit 873a255

Please sign in to comment.