-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathbootstrap.php
More file actions
37 lines (25 loc) · 990 Bytes
/
Copy pathbootstrap.php
File metadata and controls
37 lines (25 loc) · 990 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
<?php
declare(strict_types=1);
use Symfony\Component\Dotenv\Dotenv;
use function Flow\Filesystem\DSL\path_real;
require __DIR__ . '/vendor/autoload.php';
putenv('FLOW_MONOREPO_PROJECT_ROOT=' . __DIR__);
$_ENV['FLOW_MONOREPO_PROJECT_ROOT'] = $_SERVER['FLOW_MONOREPO_PROJECT_ROOT'] = __DIR__;
$dotenv = (new Dotenv())->usePutenv(true);
if (is_file($distEnv = __DIR__ . '/.env.dist')) {
$dotenv->load($distEnv);
}
if (is_file($localEnv = __DIR__ . '/.env')) {
$dotenv->overload($localEnv);
}
$cacheDir = (string) getenv('FLOW_LOCAL_FILESYSTEM_CACHE_DIR');
if ($cacheDir === '') {
throw new RuntimeException('FLOW_LOCAL_FILESYSTEM_CACHE_DIR unset');
}
$resolvedCacheDir = path_real($cacheDir)->path();
if (in_array($resolvedCacheDir, ['', '/', __DIR__, getcwd()], true)) {
throw new RuntimeException(sprintf(
'FLOW_LOCAL_FILESYSTEM_CACHE_DIR resolves to "%s" (project root, cwd or filesystem root) — refusing to run.',
$resolvedCacheDir,
));
}