gecche / laravel-multidomain

A Laravel extension for using a laravel application on a multi domain setting
MIT License
838 stars 105 forks source link

Local and Server - should both domains exist in domain.php or environment-specific configuration #57

Closed centralcybersecurity closed 3 years ago

centralcybersecurity commented 3 years ago

Hi, I have added all .test domains for the local machine and it is working fine. Now I need to move the project to the server and I am wondering the best way to add live domains as I want to manage both local and production environment without disturbing the code.

So then do I need to add .env.livedomain.com in addition to already created .env.testdomain.test and also add domains in the config/domain.php.

Am I on the right path? If there's a configuration that is set for live and local that automatically gets switched based on the environment, that'll be great. Please share your inputs at your convenience.

Thanks Newbie.

gecche commented 3 years ago

Hi,

sorry for the delay but I'm very constrained in this period.

I'm not sure to have understood properly your question, but consider that to date the domain.php config file is only a list of registered domains but there is no real effect in the code unless you use it inside YOUR code.

Basically what I usually do is that in production server I simply use php artisan domain:add livedomain.com which creates the livedomain.com env file and adds a line in the domain.php config file.

Local sites are also inside the domain.php list but it is not important, while the local envs are ignored by git in my settings so I don't have them in the production server.

Hope this helps, let me know if I answered your question

Cheers

Giacomo

centralcybersecurity commented 3 years ago

Thank you. I am following the same approach.