In the controller use:

$this->get('kernel')->getEnvironment()