From bfee9dc582e1e4e3317dcd05ef46bdb8d193c575 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 20 Mar 2023 14:39:03 +0100 Subject: [PATCH] Allow running Tinker commands on Lambda --- src/StorageDirectories.php | 1 + src/bref-init.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/StorageDirectories.php b/src/StorageDirectories.php index 4df6d58..753cc38 100644 --- a/src/StorageDirectories.php +++ b/src/StorageDirectories.php @@ -26,6 +26,7 @@ public static function create() self::Path . '/bootstrap/cache', self::Path . '/framework/cache', self::Path . '/framework/views', + self::Path . '/psysh', ]; $directories = array_filter($directories, static fn ($directory) => ! is_dir($directory)); diff --git a/src/bref-init.php b/src/bref-init.php index 173a467..5a87031 100644 --- a/src/bref-init.php +++ b/src/bref-init.php @@ -15,6 +15,11 @@ MaintenanceMode::setUp(); + // Move the location of the PsySH config cache to `/tmp` (because it is writable) + $xdgHome = StorageDirectories::Path . '/psysh'; + $_SERVER['XDG_CONFIG_HOME'] = $_ENV['XDG_CONFIG_HOME'] = $xdgHome; + putenv("XDG_CONFIG_HOME=$xdgHome"); + $defaultConfigCachePath = $_SERVER['LAMBDA_TASK_ROOT'] . '/bootstrap/cache/config.php'; if (file_exists($defaultConfigCachePath)) {