Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to map project directory in Homestead.yaml using relative path

I have a per-project installation of Homestead in my Laravel project, using the guide at https://laravel.com/docs/5.4/homestead#per-project-installation.

I want the Homestead.yaml file to map the project directory as a folder accessible in the Vagrant VM.

I want to do this such that the Homestead.yaml file can be shared between development machines without alteration.

The Homestead.yaml file is in the project directory as is the Vagrantfile file.

Therefore I want to identify the project directory relatively, rather than by its full path.

Something like:

folders:
    -
        map: %CurrentDir%
        to: /home/vagrant/Code/project

(I invented %CurrentDir% for the sake of this example.)

Or even better without hardcoding the name of the project directory.

I'm on Windows and would prefer a platform-agnostic solution.

How can I do this?

like image 911
cja Avatar asked Oct 23 '25 03:10

cja


2 Answers

This works on macOSX w/ vagrant 2.0.1 / homestead 6.5:

folders:
    -
        map: ./
        to: /home/vagrant/code/project
like image 75
mgherkins Avatar answered Oct 25 '25 19:10

mgherkins


On Windows 10 this works:

folders:
    -
        map: %CurrentDir%
        to: /home/vagrant/Code/project

Yet to test on another platform...

like image 37
cja Avatar answered Oct 25 '25 18:10

cja