vvv-demo-1
vvv-demo-1 copied to clipboard
how to use variables for the vvv-hosts and .conf files
I'm trying to set up an interactive version of this repo, so the hostname and database name can be provided from user input or bash variables, rather than being ardcoded into these files.
The vvv-init.sh is the only shell script, and the other to files are parsed somehow later.
Say I have a config.sh with this:
export NEWSITENAME = "mysite";
export NEWDBNAME = "mydb" ;
For vvv-hosts I'm creating that directly from the vvv-init.sh like this:
# import the config to keep it DRY
. config.sh; // (to-do: alternatively ask for user input...)
echo "Commencing setup of $NEWSITENAME"
touch "vvv-hosts"
echo "${NEWSITENAME}.de >" | vvv-hosts
but now I still need to handle vvv-nginx.conf, and I'd like not to autogenerate these files, so how can I pass $NEWSITENAME and $NEWDBNAME into this file so it will be parsed right?
You may want to check out the Yeoman generator for VVV, or the vvv-site-wizard. They both accomplish more-or-less the same thing.