forked from shenanigans-be/miltydraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.php
More file actions
39 lines (30 loc) · 993 Bytes
/
Copy pathboot.php
File metadata and controls
39 lines (30 loc) · 993 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
<?php
if (!file_exists('vendor/autoload.php')) {
die("<h2>No vendor directory found. Try running composer install.</h2>");
}
require_once 'vendor/autoload.php';
require_once 'helpers.php';
foreach (glob(__DIR__ . '/app/*.php') as $file) {
require_once $file;
}
try {
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
} catch (Exception $e) {
die("<h2>No .env file found. See .env.example or the readme for details</h2>");
}
if (!isset($_ENV['URL'])) {
die("<h2>.env file is incomplete: no URL set.</h2>");
}
if (!isset($_ENV['STORAGE'])) {
die("<h2>.env file is incomplete: no STORAGE set.</h2>");
}
if ($_ENV['STORAGE'] == "local") {
if (!isset($_ENV['STORAGE_PATH'])) {
die("<h2>.env file is incomplete: if STORAGE is local, then STORAGE_PATH is required.</h2>");
} else {
if (!is_writable($_ENV['STORAGE_PATH'])) {
die("<h2>STORAGE_PATH does not exist or is not writeable.</h2>");
}
}
}