summaryrefslogtreecommitdiff
path: root/src/App.php
blob: 9516a06d496c9cf7703a62dccc69df672b5356c3 (plain)
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
<?php

namespace App;

use App\gemini\Gemini;
use App\http\Http;

class App
{
  private $appRunner;

  public function __construct() {
    if ($_ENV['APP_ENV'] === 'development') {
      error_reporting(E_ALL);
    }

    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
  {
    $this->appRunner->run();
  }
}