Jamesking56
Jamesking56

Reputation: 3901

Laravel Homestead using both Windows and Mac

Following Laravel's 5.1 documentation about using Homestead on a per-project basis, I ran the commands to create a Homestead Vagrantfile inside of my Git repository for my project, I did this on my Macbook. Here is the Homestead.yaml for that:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: projectname
name: projectname
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: "/Users/user/Sites/personal/projectname"
      to: "/home/vagrant/projectname"

sites:
    - map: homestead.app
      to: "/home/vagrant/projectname/public"

databases:
    - projectname

variables:
    - key: APP_ENV
      value: local

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 93000
#       to: 9300
#     - send: 7777
#       to: 777
#       protocol: udp

Problem is, after pushing this to Git and pulling down on my PC, the path in the Homestead.yaml file is now completely wrong so that it won't work...

How can I abstract the path from Homestead.yaml to an environment variable so that I can share a vagrant VM across operating systems?

Upvotes: 2

Views: 296

Answers (1)

Jamesking56
Jamesking56

Reputation: 3901

Managed to solve it!

If I set the folder to "." it will use the current directory which works for both Mac and Windows!

...

folders:
    - map: "."
      to: "/home/vagrant/projectname"

...

Meaning now I have a Homestead vagrant machine in Git that I can use on both Mac and Windows :D

Upvotes: 5

Related Questions