0

I'm pretty new to laravel (about 8 months) to be exact. I develop in several different environments (Windows, Mac and Linux). I find myself having to set different configurations for different the different environments. What I'm looking to do is set up a dynamic way to auto detect my environment based on the host name of my computer. That way when I hop on my Windows machine it knows to point to a local sql server at home. When I'm on my MacBook, it'll automatically know to set to point to my cloud sql server... etc. I've read several posts about it, but none of them work for 5.3. Most of them refer to a start.php file that no longer comes in my app directory. I'd love some help with this.

sogeniusio
  • 111
  • 3
  • 14
  • set up vagrant, homestead and have different `env` file for each machine. – Mubin Feb 02 '17 at 14:34
  • https://laravel.com/docs/5.3/configuration – aynber Feb 02 '17 at 14:34
  • Possible duplicate of [PHP script - detect whether running under linux or Windows?](http://stackoverflow.com/questions/5879043/php-script-detect-whether-running-under-linux-or-windows) – Rwd Feb 02 '17 at 14:54

1 Answers1

0

You could achieve this simply by having different variables set in the 3 different env files. Make sure that the env file is in your gitignore and you will be able to use git to push/pull to all three, and each one will know it's specific configuration based on the values stored in their env file.

https://laravel.com/docs/5.3/configuration#environment-configuration

Michael Rodriguez
  • 2,142
  • 1
  • 9
  • 15
  • Thanks for this input. Problem is, I my Projects folder synced using Resilio sync. I don't pay for selective syncing. – sogeniusio Feb 02 '17 at 20:27