Setting server variables for a site in homestead.yaml

I hope I can set server variables for specific sites, in this case the URL used for acceptance testing with Behat.

I can set this manually in nginx, for example:

fastcgi_param  APP_ENV  "acceptance";

      

However, I would like to know if there is a way to define this in homestead.yaml, so I don't need to add this line every time I provide, or if a colleague needs to configure it on their machine.

I would like to do something like:

sites:
    - map: www.mysite.com
      to: /home/vagrant/e247/nimble-admin/public
    - map: www.mysite.test
      to: /home/vagrant/e247/nimble-admin/public
      variables:
        - key: APP_ENV
          value: acceptance

variables:
    - key: APP_ENV
      value: local

      

+3


source to share


1 answer


You can do exactly that and exactly the way you did it.

From this page: https://scotch.io/tutorials/getting-started-with-laravel-homestead#creating-environment-variables

At the bottom of your Homestead.yaml file, just add something like this:

variables:
    - key: APP_DEBUG
    value: true

      



Remember to remove or comment out the values ​​from your .env file if you defined them there, as this will overwrite what you defined in your homestead.yaml

To use this value:

$app_env = getenv('APP_DEBUG'); // returns "true"

      

0


source







All Articles