-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to run Laravel under custom vendor location #131
Changes from 15 commits
2542004
4728576
7b9da48
d77f507
adaa506
70d36a1
b0af019
4d3627d
74f4192
e516f0a
d283a70
f7a8b08
06438bc
cf8341c
e6b346c
ad2c698
235b2fa
727e4f0
f604978
70976ec
6e242be
d27c72b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
use Bref\LaravelBridge\StorageDirectories; | ||
|
||
Bref::beforeStartup(static function () { | ||
$laravelHome = resolveBootstrapLocation(); | ||
|
||
if (! defined('STDERR')) { | ||
define('STDERR', fopen('php://stderr', 'wb')); | ||
} | ||
|
@@ -26,7 +28,7 @@ | |
return; | ||
} | ||
|
||
$defaultConfigCachePath = $_SERVER['LAMBDA_TASK_ROOT'] . '/bootstrap/cache/config.php'; | ||
$defaultConfigCachePath = $laravelHome . '/bootstrap/cache/config.php'; | ||
|
||
if (file_exists($defaultConfigCachePath)) { | ||
return; | ||
|
@@ -43,8 +45,20 @@ | |
fwrite(STDERR, "Running 'php artisan config:cache' to cache the Laravel configuration\n"); | ||
|
||
// 1>&2 redirects the output to STDERR to avoid messing up HTTP responses with FPM | ||
passthru('php artisan config:cache 1>&2'); | ||
passthru("php {$laravelHome}artisan config:cache 1>&2"); | ||
} | ||
}); | ||
|
||
Bref::setContainer(static fn() => new HandlerResolver); | ||
|
||
function resolveBootstrapLocation(): string | ||
{ | ||
$laravelHome = $_SERVER['LAMBDA_TASK_ROOT'] . '/bootstrap/cache/config.php'; | ||
|
||
if (file_exists($laravelHome)) { | ||
return $_SERVER['LAMBDA_TASK_ROOT']; | ||
} | ||
|
||
// Going up 4 directories will get us from `vendor/brefphp/laravel-bridge/src` to the Laravel root folder | ||
return realpath(__DIR__ . '/../../../../'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hey @alustau this is breaking the invocation of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This inline comment is not marked as "obsolete", is this resolved? I didn't see any new commits related to this, not sure what to do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had forgotten to merge the PR that was addressing this 😅 |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function seems to duplicate the other
resolveBootstrapLocation()
function, but with a slightly different implementation (but same name), any reason for that?Can we merge both functions into one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just addressed this