-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.php
38 lines (31 loc) · 868 Bytes
/
swagger.php
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
<?php
function loadEnv($path)
{
if (!file_exists($path)) {
return;
}
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
if (strpos(trim($line), '#') === 0) {
continue;
}
if (strpos($line, '=') !== false) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
$value = trim($value, '"');
putenv("$key=$value");
}
}
}
loadEnv(__DIR__ . '/.env');
$constants = [
'APP_NAME' => getenv('APP_NAME') ?: 'Laravel App',
'APP_VERSION' => getenv('APP_VERSION') ?: '1.0',
'APP_URL' => getenv('APP_URL') ?: 'http://laravel-app.local'
];
foreach ($constants as $key => $value) {
if(!defined($key)) {
define($key, $value);
}
}