Using one puphpet config for both osx & win

83 views Asked by At

Is it possible with puphpet configs to have the code directory change according to the host OS?

I get that this can be done with the actual vagrant file, but I can't see how to do it from the yaml.

I've attempted to add a qualifying field to the yaml:

    synced_folder:
        E6zs5ESFmosx:
            owner: ''
            group: ''
            source: '/Users/user/Development/www'
            target: /var/www
            sync_type: osx
            rsync:
                auto: 'false'
        E6zs5ESFmwin:
            owner: ''
            group: ''
            source: 'I:\Development\www'
            target: /var/www
            sync_type: win
            rsync:
                auto: 'false'

And then alter the vagrant file to switch accordingly:

elsif folder['sync_type'] == 'osx'
        config.vm.synced_folder '#{folder['source']}', "#{folder['target']}", id: "#{i}", type: 'nfs'

But this still gives an error about I:\Development\www not being available when attempting to vagrant up within osx.

What is the best way to fix this? Simply remove the folders from the yaml and manually define them in the vagrant file? This means that there is a little bit of work every time I generate a new config using puphpet. Not that bad, but it seems to me that there should be an easier way.

1

There are 1 answers

0
Juan Treminio On BEST ANSWER

You can override settings inside your config.yaml from a config-custom.yaml file. Just create a new file and change the blocks you'd like.

deep_merge is used, so you only need to change the blocks you want, and not include what you want to keep as default.

Aside from that, you can also edit the Vagrantfile to include more config files depending on host OS.