summaryrefslogtreecommitdiff
path: root/src/App.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/App.php')
-rw-r--r--src/App.php32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/App.php b/src/App.php
index 7524d38..9516a06 100644
--- a/src/App.php
+++ b/src/App.php
@@ -2,34 +2,32 @@
namespace App;
-use Symfony\Component\HttpFoundation\Request;
+use App\gemini\Gemini;
+use App\http\Http;
class App
{
+ private $appRunner;
+
public function __construct() {
if ($_ENV['APP_ENV'] === 'development') {
error_reporting(E_ALL);
}
- // Session
- session_start();
-
- // DB
- DB::init();
-
- // Router
- Router::init(Request::createFromGlobals());
-
- // View
- View::init();
-
- // Events
- new EventRunner();
+ if (isset($_ENV['GEMINI'])) {
+ $this->appRunner = new Gemini([
+ 'file' => dirname(__DIR__) . '/cert.pem',
+ 'key' => dirname(__DIR__) . '/key.rsa',
+ 'passphrase' => '',
+ ], $_ENV['APP_HOST']);
+ }
+ else {
+ $this->appRunner = new Http();
+ }
}
public function run(): void
{
- $response = Router::execute();
- $response->send();
+ $this->appRunner->run();
}
}