From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 16 Feb 2020 23:43:44 +0000 (+0100)
Subject: Fix PeerTube config DB password bug.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/ledger?a=commitdiff_plain;h=646a9f2a4e7afefec8ae1bf9d5a4535b99bc6914;p=config

Fix PeerTube config DB password bug.
---

diff --git a/buster/other_files/peertube_db_password.yaml b/buster/other_files/peertube_db_password.yaml
deleted file mode 100644
index 4682ad5..0000000
--- a/buster/other_files/peertube_db_password.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-database:
-  password: 'REPLACE_ME'
diff --git a/buster/other_files/peertube_production.yaml b/buster/other_files/peertube_production.yaml
index 3cc2d81..32f905f 100644
--- a/buster/other_files/peertube_production.yaml
+++ b/buster/other_files/peertube_production.yaml
@@ -34,6 +34,7 @@ trust_proxy:
 
 # Your database name will be "peertube"+database.suffix
 database:
+  password: 'peertube'
   hostname: 'localhost'
   port: 5432
   suffix: '_prod'
diff --git a/buster/setup_scripts/restore_app.sh b/buster/setup_scripts/restore_app.sh
index a71ed8d..dd1d856 100755
--- a/buster/setup_scripts/restore_app.sh
+++ b/buster/setup_scripts/restore_app.sh
@@ -35,7 +35,7 @@ done
 if [ "${app}" = "pleroma" ]; then
     db_pw=$(cat /etc/pleroma/config.exs | grep password | sed 's/[ ]*password\: *//g' | sed 's/,//g' | sed 's/"//g')
 elif [ "${app}" = "peertube" ]; then
-    db_pw=$(cat /var/www/peertube/config/db_password.yaml | grep password | head -1 | sed "s/[ ]*password\: *//g" | sed "s/'//g")
+    db_pw=$(cat /var/www/peertube/config/production.yaml | grep password | head -1 | sed "s/[ ]*password\: *//g" | sed "s/'//g")
 fi
 su postgres -lc "psql -c \"ALTER USER ${app} WITH PASSWORD '${db_pw}';\""
 
diff --git a/buster/setup_scripts/setup_peertube.sh b/buster/setup_scripts/setup_peertube.sh
index 5e47f3a..c92be5c 100755
--- a/buster/setup_scripts/setup_peertube.sh
+++ b/buster/setup_scripts/setup_peertube.sh
@@ -55,12 +55,10 @@ su -l peertube -c "cd peertube-latest && yarn install --production --pure-lockfi
 
 # Configure PeerTube.
 cp "${config_tree_prefix}/other_files/peertube_production.yaml" /var/www/peertube/config/production.yaml
-cp "${config_tree_prefix}/other_files/peertube_db_password.yaml" /var/www/peertube/config/db_password.yaml
 chown peertube:peertube /var/www/peertube/config/production.yaml
-chown peertube:peertube /var/www/peertube/config/db_password.yaml
 sed -i "s/admin\@example\.com/${mail}/g" config/production.yaml
 sed -i "s/example\.com/${domain}/g" config/production.yaml
-sed -i "s/password: 'REPLACE_ME'/password: '${db_pw}'/g" config/db_password.yaml
+sed -i "s/password: 'peertube'/password: '${db_pw}'/g" config/production.yaml
 
 # Configure NGINX.
 cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube