From 120385b81d656337aae744d15df13eb7adc63b13 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Sat, 7 Sep 2019 17:27:01 -0400 Subject: [PATCH] Fire the .valet-env environment var detection earlier To support smarter detection of static-file detection and allow Valet to mutate the URI for externally-hosted assets (save bandwidth and local storage etc), detecting any custom-inserted environment variables needs to happen slightly sooner in the execution cycle. Discovered this issue when troubleshooting #729 and #247. While they have other workarounds, this PR simplifies things, and potentially makes custom drivers slightly easier too ... when the use-case applies. --- server.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server.php b/server.php index bd80d3c..74aebe1 100644 --- a/server.php +++ b/server.php @@ -121,6 +121,13 @@ function valet_default_site_path($config) $_SERVER['HTTP_X_FORWARDED_HOST'] = $_SERVER['HTTP_X_ORIGINAL_HOST']; } +/** + * Attempt to load server environment variables. + */ +$valetDriver->loadServerEnvironmentVariables( + $valetSitePath, $siteName +); + /** * Allow driver to mutate incoming URL. */ @@ -135,13 +142,6 @@ function valet_default_site_path($config) return $valetDriver->serveStaticFile($staticFilePath, $valetSitePath, $siteName, $uri); } -/** - * Attempt to load server environment variables. - */ -$valetDriver->loadServerEnvironmentVariables( - $valetSitePath, $siteName -); - /** * Attempt to dispatch to a front controller. */