add support for a local vagrant.settings.yml

this allows to configure some settings per-machine
for now cpu and ram of the wings vm
This commit is contained in:
Jakob Schrettenbrunner
2021-01-06 20:12:39 +01:00
parent 5399857793
commit 646c76ac00
2 changed files with 13 additions and 2 deletions

3
.gitignore vendored
View File

@@ -3,3 +3,6 @@
.data/**
.docker-sync/**
.idea
# intended for per-machine config
vagrant.config.yml

12
Vagrantfile vendored
View File

@@ -1,3 +1,6 @@
require 'yaml'
require 'pathname'
["vagrant-vbguest", "vagrant-hostmanager"].each do |plugin|
unless Vagrant.has_plugin?(plugin)
raise plugin + " plugin is not installed. Hint: vagrant plugin install " + plugin
@@ -6,6 +9,11 @@ end
vagrant_root = File.dirname(__FILE__)
$configMap = FileTest.exist?("#{vagrant_root}/vagrant.config.yml") ? YAML.load_file("#{vagrant_root}/vagrant.config.yml") : {}
def config(key, def_val)
return $configMap.dig(*key.split(".")) || def_val
end
Vagrant.configure("2") do |config|
config.hostmanager.enabled = false
config.hostmanager.manage_host = true
@@ -76,8 +84,8 @@ Vagrant.configure("2") do |config|
wings.vm.box = "bento/ubuntu-18.04"
wings.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
v.memory = config("wings.memory", 2048)
v.cpus = config("wings.cpus", 2)
v.customize ["modifyvm", :id, "--cpuexecutioncap", "75"]
end