You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some sites or frameworks depend on server environment variables to be set on the server configs (at the Apache vhost or nginx.conf levels), and do not provide a way for those variables to be declared on the code.
A quick example of this, would be specific to my line of work: Magento.
A Magento application that hosts two websites needs for the server to have two variables set: MAGE_RUN_CODE and MAGE_RUN_TYPE. These variables are read on the index.php file and its the way the application knows what website to serve.
I imagine this is not an uncommon situation...
Currently, there is no way for me to set these environment variables with Valet without some ugly hack, or editing my index.php file to hardcode those values in.
My proposal is to create a .env.valet file at the root of the application ($sitePath), and have Valet load those for me.
The idea is quite simple: the file will be read by the Valet Driver, and if the top level key matches the requested site, then the key-value pairs inside will be loaded as server environment variables.
In the example above, when website1.dev is requested, then this will be loaded:
I've submitted a proposal for this feature, but I'm sure it could use further discussion. If its liked, then it would require a little documentation to explain the functionality and the .env.valet file structure.
The text was updated successfully, but these errors were encountered: