2017-06-06 4 views
0

config.vm.synced_folderへのパラメータの追加を許可します。私はユーザーにこの設定に追加のパラメータを追加させたい。悪影響ファイルのマージ/追加パラメータ

私がこれまで持っている:

append_params = 'x: false, y: false' 
config.vm.synced_folder x['folder'], "/var/www", create: true, type: "nfs", append_params 

私は, append_paramsを削除した場合、それは動作します。しかし、それには、エラーで失敗します。

There is a syntax error in the following Vagrantfile. The syntax error 
message is reproduced below for convenience: 
D:/x/Vagrantfile:32: syntax error, unexpected '\n', expecting => 

がどのように私はconfig.vm.synced_folderへのリクエストに応じて追加のパラメータを追加することができますか?

+1

メイクVagrantfileの内側に解析され得るパラメータを持ついくつかのconfig.ymlを持っているとして、私の場合に機能するソリューションを見つけた '' append_params' Hash'例えば2行目の 'append_params = {x:false、y:false}'と '** append_params' – engineersmnky

答えて

0

だから最終的に私は私が

# config.yml 
append_params: 
    :someVar: false 
    :fsnotify: true 

# Vagrantfile 
if File.file?("config.yml") 
    parameters = YAML.load_file 'config.yml' 
else 
    parameters = {} 
end 
... 
Vagrant.configure("2") do |config| 
    config.ssh.forward_agent = true 
    ... 
    config.vm.synced_folder parameters['synced_folder'], "/var/www", parameters['append_params'].merge({create: true, type: "nfs"}) 
関連する問題