浏览代码

Peertube database creation

Bob Mottram 7 年前
父节点
当前提交
1ab966a6ed
共有 1 个文件被更改,包括 3 次插入12 次删除
  1. 3
    12
      src/freedombone-app-peertube

+ 3
- 12
src/freedombone-app-peertube 查看文件

@@ -62,14 +62,9 @@ function peertube_create_database {
62 62
     fi
63 63
 
64 64
     systemctl restart postgresql
65
-    add_postgresql_user peertube "$PEERTUBE_ADMIN_PASSWORD" encrypted
66
-    run_system_query_postgresql "create database peertube;"
67
-    # temporarily allow the user to create databases
68
-    run_system_query_postgresql "ALTER USER peertube CREATEDB;"
69
-    run_system_query_postgresql "ALTER USER peertube SUPERUSER;"
70
-    run_system_query_postgresql "GRANT ALL ON ALL tables IN SCHEMA public TO peertube;"
71
-    run_system_query_postgresql "GRANT ALL ON ALL sequences IN SCHEMA public TO peertube;"
72
-    run_system_query_postgresql "CREATE EXTENSION citext;"
65
+    run_system_query_postgresql "CREATE USER peertube WITH PASSWORD '$PEERTUBE_ADMIN_PASSWORD';"
66
+    run_system_query_postgresql "CREATE DATABASE peertube OWNER peertube;"
67
+    run_system_query_postgresql "GRANT ALL PRIVILEGES ON DATABASE peertube to peertube;"
73 68
     run_system_query_postgresql "set statement_timeout to 40000;"
74 69
 }
75 70
 
@@ -545,10 +540,6 @@ function install_peertube {
545 540
         exit 5293593
546 541
     fi
547 542
 
548
-    # revoke the ability to create databases for this user
549
-    run_system_query_postgresql "ALTER USER peertube NOSUPERUSER;"
550
-    run_system_query_postgresql "ALTER USER peertube NOCREATEDB;"
551
-
552 543
     PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
553 544
 
554 545
     echo '[Unit]' > /etc/systemd/system/peertube.service