From: Richie Zhang <12566991+StaticallyTypedRice@users.noreply.github.com> Date: Thu, 6 Feb 2020 02:15:28 +0000 (-0800) Subject: Create db-init.sh X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/static/README.zh.hant.md?a=commitdiff_plain;h=da6cdb7c26af1041ce179a68841437d5dcc6b234;p=lemmy.git Create db-init.sh --- 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