drupal-vm icon indicating copy to clipboard operation
drupal-vm copied to clipboard

How/Where to set ENV['DRUPALVM_CONFIG_DIR']

Open sbubaron opened this issue 10 years ago • 3 comments

I feel like the answer to this should be obvious, but I can't seem to figure it out.

I am in the process of upgrading to 3.1, I have my Vagrantfile in the root of my repo, but I of course want to store the config and supplemental files in their own directory. In the past I hacked the Vagrantfile to support this, but I'm super excited that this functionality is now baked in!

My problem is I can't figure out how to actually set the ENV variable. Ideally I'd like to do it in Vagrantfile.local so that the process for setting it is independent of the host OS.

So I created Vagrantfile.local and added

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'

ENV['DRUPALVM_CONFIG_DIR'] = 'vagrant'

But that didn't do the trick -- I get:

Message: Errno::ENOENT: No such file or directory @ rb_sysopen - D:/git/doitsbu/default.config.yml

Where I'm expecting it to look at D:/git/doitsbu/vagrant/default.config.yml - I'm guessing this is because Vagrantfile.local gets loaded at the end of the Vagrant file?

So if that's not an option, what are my options?

Should I modify the VagrantFile directly and set it there? Do I need to set a Windows Environmental variable (I tried that, without success, but maybe I did something silly?)

Thanks in advance! Its awesome seeing how fast the project is moving even since DrupalCon.

sbubaron avatar Jun 09 '16 19:06 sbubaron

@sbubaron - Does the way BLT implements this help any? https://github.com/acquia/blt/blob/8.x/template/scripts/drupal-vm/Vagrantfile

geerlingguy avatar Jun 09 '16 20:06 geerlingguy

Yes! Ugh, that was too obvious =)

--Rich

sbubaron avatar Jun 09 '16 21:06 sbubaron

Sometimes it's best to just see a working example :)

geerlingguy avatar Jun 09 '16 21:06 geerlingguy