Skip to content

Commit

Permalink
Use phpdotenv methods instead of getenv/putenv
Browse files Browse the repository at this point in the history
  • Loading branch information
bioteck committed Feb 14, 2015
1 parent 388aa6a commit c7c85b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function bootstrap(Application $app)
{
try
{
Dotenv::makeMutable();

Dotenv::load($app['path.base'], $app->environmentFile());
}
catch (InvalidArgumentException $e)
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Foundation/Testing/ApplicationTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Illuminate\Foundation\Testing;

use Dotenv;
use Illuminate\Http\Request;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;

Expand All @@ -26,8 +27,8 @@ trait ApplicationTrait {
*/
protected function refreshApplication()
{
putenv('APP_ENV=testing');
Dotenv::setEnvironmentVariable('APP_ENV', 'testing');

$this->app = $this->createApplication();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ function view($view = null, $data = array(), $mergeData = array())
*/
function env($key, $default = null)
{
$value = getenv($key);
$value = Dotenv::findEnvironmentVariable($key);

if ($value === false) return value($default);
if ($value === null) return value($default);

switch (strtolower($value))
{
Expand Down

0 comments on commit c7c85b1

Please sign in to comment.