24 lines
707 B
Bash
Executable File
24 lines
707 B
Bash
Executable File
#!/bin/sh
|
|
|
|
echo "Starting PocketBase initialization..."
|
|
|
|
DB_FILE="./pb_data/data.db"
|
|
|
|
# Step 1: Ensure the database file exists
|
|
if [ ! -f "$DB_FILE" ]; then
|
|
echo "Database not found. Copying default data..."
|
|
cp -r ./pb_data_default/. ./pb_data/
|
|
|
|
# This is only needed if we don't copy the default data
|
|
# ./pocketbase serve --http 0.0.0.0:8090 --automigrate=0 & sleep 4
|
|
# kill $(pidof pocketbase)
|
|
|
|
# Creates the admin user or updates if already exists
|
|
echo "Creating admin user"
|
|
./pocketbase superuser upsert "$POCKETBASE_ADMIN_USERNAME" "$POCKETBASE_ADMIN_PASSWORD"
|
|
fi
|
|
|
|
# Step 3: Start PocketBase normally
|
|
echo "Starting PocketBase..."
|
|
./pocketbase serve --http 0.0.0.0:8090
|