Dhii / scotch-bedrock

2 stars 2 forks source link

Extract Provisioning Script #13

Open XedinUnknown opened 7 years ago

XedinUnknown commented 7 years ago

The Problem

The provisioning shell script is currently inline. This makes it impossible to run the script without invoking the Vagrant provisioning procedure, and is just wrong. Correct it at once.

Suggested Solution

Of course the variables from the Vagrantfile need to go into the script somehow. There are 3 known ways to do that:

  1. Extract the configuration into a separate file, and read the values from there. Perhaps, just a script with VAR="value" statements that can be sourced. This has the disadvantage of making the hostname inaccessible from the Vagrantfile, where it is necessary to configure the hostsupdater plugin. Same with path_apache_www, which is needed to mount the project directory in the VM.
  2. In the Vagrantfile, use export commands in an inline script to assign "global" variables, then run the separate provisioning shell script.
  3. Make the provisioning shell script accept arguments via parameters. In this case, there may be too many parameters, and it increases the script's complexity.