From 646c76ac00a0baedd94481618abd18ac00aad22f Mon Sep 17 00:00:00 2001 From: Jakob Schrettenbrunner Date: Wed, 6 Jan 2021 20:12:39 +0100 Subject: [PATCH] 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 --- .gitignore | 3 +++ Vagrantfile | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 528e67d..6bb185b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ .data/** .docker-sync/** .idea + +# intended for per-machine config +vagrant.config.yml \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile index 8477372..b9615f7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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