This commit is contained in:
June 2025-08-12 11:55:12 +12:00
parent e443c28fc4
commit fde087d1ed
Signed by: breadone
GPG Key ID: FDC19FE143200483
2 changed files with 5 additions and 3 deletions

View File

@ -1,3 +1,4 @@
PB_ADMIN_EMAIL=admin@example.com PB_ADMIN_EMAIL=admin@example.com
PB_ADMIN_PASSWORD=secret-password PB_ADMIN_PASSWORD=secret-password
PB_URL=http://pocketbase:8080 PB_URL=http://pocketbase:8080
PB_DATA_DIR=/pb/pb_data

View File

@ -12,8 +12,9 @@ set -e
# if there are no users yet, create the superuser # if there are no users yet, create the superuser
# we check the sqlite file for any existing record in the users table # we check the sqlite file for any existing record in the users table
if ! sqlite3 "/pb/pb_data/data.db" \ if [ ! -f "${PB_DATA_DIR}/pb_data.db" ] \
"SELECT id FROM users WHERE email='${PB_ADMIN_EMAIL}' LIMIT 1;" \ ! sqlite3 "${PB_DATA_DIR}/data.db" \
"SELECT id FROM _superusers WHERE email='${PB_ADMIN_EMAIL}' LIMIT 1;" \
| grep -q .; then | grep -q .; then
echo ">>> Creating PocketBase superuser: ${PB_ADMIN_EMAIL}" echo ">>> Creating PocketBase superuser: ${PB_ADMIN_EMAIL}"