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

Add support for vagrant-hostsupdater #137

@rauluranga

Description

@rauluranga

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions