Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Add support for vagrant-hostsupdater #137

Open
rauluranga opened this issue May 12, 2016 · 1 comment
Open

Add support for vagrant-hostsupdater #137

rauluranga opened this issue May 12, 2016 · 1 comment

Comments

@rauluranga
Copy link

Hi!
i'm currently testing vagrant-hostsupdater plugin, with this you don't need to manually update the your host file.

this is the code so far:

config.vm.hostname = "vagrant-lamp"
  # Local Machine Hosts
  #
  # If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
  # installed, the following will automatically configure your local machine's hosts file to
  # be aware of the domains specified below. Watch the provisioning script as you may need to
  # enter a password for Vagrant to access your hosts file.
  #
  # By default, we'll include all the domains located under the data_bags/sites directory.
  #
  if defined?(VagrantPlugins::HostsUpdater)
    hosts = []
    Dir.glob('data_bags/sites/*.json') do |json_file|
      file = File.read(json_file)
      data = JSON.parse(file)
      hosts.push(data['host'])
    end

    # Pass the found host names to the hostsupdater plugin so it can perform magic.
    config.hostsupdater.aliases = hosts
    config.hostsupdater.remove_on_suspend = true
  end

any thoughts?

@r8
Copy link
Owner

r8 commented May 16, 2016

Hi Raúl,

That looks awesome!
Actually I had it in my todo for more then year. But unfortunately, I'm pretty busy with my work lately, so haven't had the chance to do it myself.
Thus said, I would greatly appreciate the pull request :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants