first
This commit is contained in:
22
server-api/app/bootstrap/Dotenv.php
Normal file
22
server-api/app/bootstrap/Dotenv.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\bootstrap;
|
||||
|
||||
use Dotenv\Dotenv as DotenvLoader;
|
||||
use Webman\Bootstrap;
|
||||
use Workerman\Worker;
|
||||
|
||||
class Dotenv implements Bootstrap
|
||||
{
|
||||
private static bool $loaded = false;
|
||||
|
||||
public static function start(?Worker $worker): void
|
||||
{
|
||||
if (self::$loaded || !is_file(base_path('.env'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
DotenvLoader::createImmutable(base_path())->safeLoad();
|
||||
self::$loaded = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user