Spaces:
Sleeping
Sleeping
Upload entrypoint.sh
Browse files- entrypoint.sh +12 -6
entrypoint.sh
CHANGED
|
@@ -65,14 +65,20 @@ rclone copyto "$REMOTE_PATH/.filebrowser.db" "$DB_PATH" --config "$CONFIG_PATH"
|
|
| 65 |
# Configure admin password via FILEBROWSER_PASSWORD secret if set
|
| 66 |
if [ -n "$FILEBROWSER_PASSWORD" ]; then
|
| 67 |
echo "FILEBROWSER_PASSWORD secret is set. Configuring admin password..."
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
else
|
| 73 |
-
echo "Initializing database and creating admin user..."
|
| 74 |
filebrowser config init -d "$DB_PATH"
|
| 75 |
filebrowser config set --root "$DATA_DIR" -d "$DB_PATH"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
filebrowser users add admin "$FILEBROWSER_PASSWORD" --perm.admin -d "$DB_PATH"
|
| 77 |
fi
|
| 78 |
fi
|
|
|
|
| 65 |
# Configure admin password via FILEBROWSER_PASSWORD secret if set
|
| 66 |
if [ -n "$FILEBROWSER_PASSWORD" ]; then
|
| 67 |
echo "FILEBROWSER_PASSWORD secret is set. Configuring admin password..."
|
| 68 |
+
|
| 69 |
+
# Initialize config if export fails (e.g. database doesn't exist or is empty)
|
| 70 |
+
if ! filebrowser config export -d "$DB_PATH" >/dev/null 2>&1; then
|
| 71 |
+
echo "Initializing database..."
|
|
|
|
|
|
|
| 72 |
filebrowser config init -d "$DB_PATH"
|
| 73 |
filebrowser config set --root "$DATA_DIR" -d "$DB_PATH"
|
| 74 |
+
fi
|
| 75 |
+
|
| 76 |
+
# Set or update the admin user password
|
| 77 |
+
echo "Setting admin user password..."
|
| 78 |
+
if filebrowser users update admin --password "$FILEBROWSER_PASSWORD" -d "$DB_PATH" >/dev/null 2>&1; then
|
| 79 |
+
echo "Admin password updated successfully."
|
| 80 |
+
else
|
| 81 |
+
echo "Admin user not found. Creating admin user..."
|
| 82 |
filebrowser users add admin "$FILEBROWSER_PASSWORD" --perm.admin -d "$DB_PATH"
|
| 83 |
fi
|
| 84 |
fi
|