-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathEnvConfiguration.php
More file actions
44 lines (35 loc) · 966 Bytes
/
EnvConfiguration.php
File metadata and controls
44 lines (35 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
declare(strict_types=1);
namespace Bow\Configuration;
use Bow\Support\Env;
class EnvConfiguration extends Configuration
{
/**
* @inheritdoc
*/
public function create(Loader $config): void
{
$envFile = $config->getBasePath() . '/.env.json';
// Check if environment is already loaded
try {
$env = Env::getInstance();
if ($env->isLoaded()) {
$this->container->instance('env', $env);
return;
}
} catch (\Bow\Application\Exception\ApplicationException $e) {
// Environment not loaded, continue to load it
}
// Load environment - will throw exception if file doesn't exist
Env::configure($envFile);
$event = Env::getInstance();
$this->container->instance('env', $event);
}
/**
* @inheritdoc
*/
public function run(): void
{
// Nothing to do
}
}