forked from helhum/dotenv-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!!!Remove compat with older SF versions
Also drop the possibility to configure a template file to be included with a cleaner way to expose env vars with different adapters. Raise PHP requirement to 7.2
- Loading branch information
Showing
11 changed files
with
84 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
language: php | ||
|
||
php: | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<?php | ||
call_user_func(static function($dotEnvFile) { | ||
if (!getenv('APP_ENV') && file_exists($dotEnvFile)) { | ||
(new \Symfony\Component\Dotenv\Dotenv(true))->load($dotEnvFile); | ||
} | ||
$class = '{$adapter}'; | ||
(new $class())->exposeToEnvironment($dotEnvFile); | ||
}, '{$env-file}'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
declare(strict_types=1); | ||
namespace Helhum\DotEnvConnector\Adapter; | ||
|
||
use Helhum\DotEnvConnector\DotEnvVars; | ||
use Symfony\Component\Dotenv\Dotenv; | ||
|
||
class SymfonyDotEnv implements DotEnvVars | ||
{ | ||
public function exposeToEnvironment(string $dotEnvFile): void | ||
{ | ||
if (!getenv('APP_ENV') && file_exists($dotEnvFile)) { | ||
$dotEnv = new Dotenv(); | ||
$dotEnv->usePutenv(); | ||
$dotEnv->load($dotEnvFile); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
declare(strict_types=1); | ||
namespace Helhum\DotEnvConnector\Adapter; | ||
|
||
use Helhum\DotEnvConnector\DotEnvVars; | ||
use Symfony\Component\Dotenv\Dotenv; | ||
|
||
class SymfonyLoadEnv implements DotEnvVars | ||
{ | ||
public function exposeToEnvironment(string $dotEnvFile): void | ||
{ | ||
if (file_exists($dotEnvFile)) { | ||
$dotEnv = new Dotenv(); | ||
$dotEnv->usePutenv(); | ||
$dotEnv->loadEnv($dotEnvFile); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Helhum\DotEnvConnector; | ||
|
||
interface DotEnvVars | ||
{ | ||
public function exposeToEnvironment(string $dotEnvFile): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters