Load site settings from dotenv and store OAuth credentials
This commit is contained in:
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use App\Config\Environment;
|
||||
|
||||
final class Request extends \support\Request
|
||||
{
|
||||
private const LOOPBACK = ['127.0.0.1', '::1'];
|
||||
@@ -21,7 +23,7 @@ final class Request extends \support\Request
|
||||
|
||||
private function fromTrustedProxy(): bool
|
||||
{
|
||||
$configured = getenv('LAYSITE_TRUSTED_PROXIES');
|
||||
$configured = Environment::get('LAYSITE_TRUSTED_PROXIES');
|
||||
$trusted = $configured === false ? self::LOOPBACK : array_map('trim', explode(',', $configured));
|
||||
|
||||
return in_array($this->getRemoteIp(), $trusted, true);
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use App\Config\Environment;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use Workerman\Protocols\Http\Session;
|
||||
@@ -26,7 +27,7 @@ final class VisitorSession
|
||||
public static function cookie(Response $response, ?Session $session, int $seconds): Response
|
||||
{
|
||||
return $response->cookie(self::COOKIE, $session?->getId() ?? '', $seconds, '/',
|
||||
secure: getenv('LAYSITE_SECURE_COOKIES') === '1', httpOnly: true, sameSite: 'Lax');
|
||||
secure: Environment::get('LAYSITE_SECURE_COOKIES') === '1', httpOnly: true, sameSite: 'Lax');
|
||||
}
|
||||
|
||||
public static function profile(?Request $request): ?array
|
||||
|
||||
Reference in New Issue
Block a user