diff options
author | Sam Pearson <sam@sgp.me.uk> | 2018-11-05 13:16:10 +0000 |
---|---|---|
committer | Sam Pearson <sam@sgp.me.uk> | 2018-11-05 13:27:02 +0000 |
commit | 94c761fc5eb91fa7b558f0c8e8bdbff4f34e2ac7 (patch) | |
tree | 2776a78ae739c965c29e9f8273fcfe5b13f9bff8 /script/setup | |
parent | 738f832405561690da3c2ad7b94b7c87c556dafc (diff) |
[Vagrant] Check and generate config file if necessary
This adds support in `script/setup` for generating a local `general.yml`
if it doesn't already exist and is run as the `vagrant` user. This is
called from the `Vagrantfile` when using the FixMyStreet Vagrant box.
[skip ci]
Diffstat (limited to 'script/setup')
-rwxr-xr-x | script/setup | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/script/setup b/script/setup index 30f375712..badf23744 100755 --- a/script/setup +++ b/script/setup @@ -3,5 +3,19 @@ set -e cd "$(dirname "$0")/.." -# Same as update for now +# If we're running in Vagrant and there isn't a valid config file, set one up. +if [ ! -f conf/general.yml ] && [ "$USER" = "vagrant" ]; then + echo -n "Setting up a default conf/general.yml file for Vagrant..." + sed -r \ + -e "s,^( *FMS_DB_HOST:).*,\\1 ''," \ + -e "s,^( *FMS_DB_NAME:).*,\\1 'fixmystreet'," \ + -e "s,^( *FMS_DB_USER:).*,\\1 'vagrant'," \ + -e "s,^( *BASE_URL:).*,\\1 'http://127.0.0.1.xip.io:3000'," \ + -e "s,^( *EMAIL_DOMAIN:).*,\\1 '127.0.0.1.xip.io'," \ + -e "s,^( *CONTACT_EMAIL:).*,\\1 'help@127.0.0.1.xip.io'," \ + -e "s,^( *DO_NOT_REPLY_EMAIL:).*,\\1 'help@127.0.0.1.xip.io'," \ + conf/general.yml-example > conf/general.yml +fi + +# The rest should be the same as update for now script/update |