How do I include variables in my VagrantFile?

后端 未结 4 758
情话喂你
情话喂你 2020-12-13 00:29

Can anyone guide me to how do I include variables in my VagrantFile? I am trying to inject configs into the Vagrantfile from an external file so that I can distribute the co

4条回答
  •  天命终不由人
    2020-12-13 01:05

    I created a library directory:

    require './lib/cfpEnvironment.rb'
    include CFPEnvironment
    

    And then did the scripting of what I need to be dynamic, defining the variables in the module created...

    CFPPorts.select{ |key, value| value.numeric? }.each { |key, value|
       config.vm.network :forwarded_port, guest: value, host: value
    }
    

    Thanks to @Matt and @strager for their answers above!

提交回复
热议问题