summaryrefslogtreecommitdiffstats
path: root/server/db-init.sh
diff options
context:
space:
mode:
authorRichie Zhang <12566991+StaticallyTypedRice@users.noreply.github.com>2020-02-05 18:15:28 -0800
committerGitHub <noreply@github.com>2020-02-05 18:15:28 -0800
commitda6cdb7c26af1041ce179a68841437d5dcc6b234 (patch)
treeaa09f751cb10cfbe26a59bf5a3961b1c89c90326 /server/db-init.sh
parentd6b4ab8abbe01c0f4610d2bfc989272293624642 (diff)
Create db-init.sh
Diffstat (limited to 'server/db-init.sh')
-rw-r--r--server/db-init.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/db-init.sh b/server/db-init.sh
new file mode 100644
index 00000000..77b9a6d7
--- /dev/null
+++ b/server/db-init.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+username=lemmy
+dbname=lemmy
+port=5432
+
+read -p "Enter database password: " -s password
+echo
+
+psql -c "CREATE USER $username WITH PASSWORD '$password' SUPERUSER;" -U postgres
+psql -c 'CREATE DATABASE $dbname WITH OWNER $username;' -U postgres
+export LEMMY_DATABASE_URL=postgres://$username:$password@localhost:$port/$dbname