Assign vagrant configuration by project root

This commit is contained in:
Chris Thompson 2018-08-23 11:51:05 -04:00
parent 87e34788c8
commit 6c51f510fa
2 changed files with 12 additions and 7 deletions

9
box/Vagrantfile vendored
View file

@ -42,12 +42,15 @@ Vagrant.require_version ">= #{vconfig['drupalvm_vagrant_version_min']}"
ensure_plugins(vconfig['vagrant_plugins'])
# Acquire a hostname from the project root
vm_hostname = File.basename(ENV['DRUPALVM_PROJECT_ROOT']).gsub("_", "-")
Vagrant.configure('2') do |config|
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
config.vm.define vconfig['vagrant_machine_name']
config.vm.define "#{vm_hostname}.local" #vconfig['vagrant_machine_name']
# Networking configuration.
config.vm.hostname = vconfig['vagrant_hostname']
# Networking configuration
config.vm.hostname = "#{vm_hostname}-coop-vm" #vconfig['vagrant_hostname']
config.vm.network :private_network,
ip: vconfig['vagrant_ip'],
auto_network: vconfig['vagrant_ip'] == '0.0.0.0' && Vagrant.has_plugin?('vagrant-auto_network')