Skip to content

Commit

Permalink
Allow dotenv version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianfeldmann committed Jul 31, 2019
1 parent 47791de commit 6dcd202
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
<include name="**/*.php"/>
</fileset>
</copy>
<copy file="${basedir}/vendor/phpoption/phpoption/LICENSE.txt" tofile="${basedir}/build/phar/lib/phpoption/LICENSE"/>
<copy todir="${basedir}/build/phar/lib/phpoption">
<fileset dir="${basedir}/vendor/phpoption/phpoption/src">
<include name="**/*.php"/>
</fileset>
</copy>

<!-- DROPBOX SDK -->
<copy file="${basedir}/vendor/kunalvarma05/dropbox-php-sdk/LICENSE" tofile="${basedir}/build/phar/lib/dropbox/LICENSE"/>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"tightenco/collect": "5.5.*",
"phpseclib/phpseclib": "~2.0",
"softlayer/objectstorage": "dev-master",
"vlucas/phpdotenv": "~2.4",
"vlucas/phpdotenv": "~2.4|~3.0",
"google/apiclient":"^2.0",
"php-opencloud/openstack": "^3.0",
"arhitector/yandex": "^2.0",
Expand Down
14 changes: 10 additions & 4 deletions src/Adapter/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @author Sebastian Feldmann <[email protected]>
* @copyright Sebastian Feldmann <[email protected]>
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://phpbu.de/
* @link https://phpbu.de/
* @since Class available since Release 4.0.0
*/
class Dotenv implements Adapter
Expand All @@ -41,9 +41,15 @@ class Dotenv implements Adapter
*/
public function setup(array $conf)
{
$path = AppUtil\Arr::getValue($conf, 'file', '.env');
$this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory());
$this->dotenv = new DotenvLib(dirname($this->file), basename($this->file));
$path = AppUtil\Arr::getValue($conf, 'file', '.env');
$this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory());

if (method_exists(DotenvLib::class, 'create')) {
$this->dotenv = DotenvLib::create(dirname($this->file), basename($this->file));
} else {
$this->dotenv = new DotenvLib(dirname($this->file), basename($this->file));
}

$this->dotenv->load();
}

Expand Down

0 comments on commit 6dcd202

Please sign in to comment.