From 982c402e8fc0d5d351f5a328cefc5a49103d3aed Mon Sep 17 00:00:00 2001 From: David Huerta Date: Mon, 19 Feb 2018 17:48:00 -0500 Subject: [PATCH] Copying existing config files and using them for restore copies. --- config/ghost/config.production.json | 2 +- config/ghost/config.production.json.orig | 2 +- setup.sh | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/config/ghost/config.production.json b/config/ghost/config.production.json index 85311ca..b2de526 100644 --- a/config/ghost/config.production.json +++ b/config/ghost/config.production.json @@ -9,7 +9,7 @@ "connection": { "host": "localhost", "user": "ghost", - "password": "4f4f2a8d6453316891c59c635f245223c4fa83a31521378a", + "password": "DB_PASSWORD_PLACEHOLDER", "database": "ghost_production" }, "debug": false diff --git a/config/ghost/config.production.json.orig b/config/ghost/config.production.json.orig index b4dccb5..573e6a7 100644 --- a/config/ghost/config.production.json.orig +++ b/config/ghost/config.production.json.orig @@ -9,7 +9,7 @@ "connection": { "host": "localhost", "user": "ghost", - "password": "4f4f2a8d6453316891c59c635f245223c4fa83a31521378a", + "password": "", "database": "ghost_production" } }, diff --git a/setup.sh b/setup.sh index 85d1ea5..b0a039a 100644 --- a/setup.sh +++ b/setup.sh @@ -22,6 +22,9 @@ apt-get -y --force-confold install tor deb.torproject.org-keyring #apt-get -y install unattended-upgrades #cp blooming-onion/config/apt/20auto-upgrades /etc/apt/apt.conf.d/. +# Copy original config in case it needs to be restored later +cp blooming-onion/config/tor/torrc ./tor/torrc.orig + echo 'Setting up Tor onion service and waiting 5 seconds for .onion address creation...' cp blooming-onion/config/tor/torrc /etc/tor/. service tor reload @@ -30,13 +33,16 @@ sleep 5s ONION_ADDRESS=`cat /var/lib/tor/hidden_service/hostname` if [ -n "$ONION_ADDRESS" ]; then + # Copy for future restore + cp /etc/nginx/sites-available/ghost blooming-onion/config/nginx/ghost.orig echo 'Setting up the web server NGINX to use Tor onion service...' cp blooming-onion/config/nginx/ghost /etc/nginx/sites-available/. sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /etc/nginx/sites-available/ghost - + # Copy for future restore + cp /var/www/ghost/config.production.json blooming-onion/config/ghost/config.production.json.orig echo 'Updating Ghost config to use .onion address...' - cp blooming-onion/config/ghost/config.production.json /var/www/ghost/. - sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /var/www/ghost/config.production.json + #cp blooming-onion/config/ghost/config.production.json /var/www/ghost/. + sed -i 's/\"url\": \"http:\/\/.*\"/\"url\": \"http:\/\/'$ONION_ADDRESS'\"/g' /var/www/ghost/config.production.json echo 'Restarting NGINX...' service nginx reload