Added environment logic in front controller (app.php)