jualhosting commited on
Commit
f013923
·
verified ·
1 Parent(s): 9f8a082

Upload 4 files

Browse files
Files changed (1) hide show
  1. entrypoint.sh +15 -0
entrypoint.sh CHANGED
@@ -62,6 +62,21 @@ touch "$DB_PATH"
62
  echo "Checking for persistent database on Google Drive..."
63
  rclone copyto "$REMOTE_PATH/.filebrowser.db" "$DB_PATH" --config "$CONFIG_PATH" --drive-skip-shortcuts --drive-acknowledge-abuse $SHARED_FLAG || true
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  # 2. Download files from Google Drive to local /data directory
66
  echo "Syncing files from Google Drive..."
67
  rclone copy "$REMOTE_PATH" "$DATA_DIR" --config "$CONFIG_PATH" --drive-skip-shortcuts --drive-acknowledge-abuse $SHARED_FLAG || true
 
62
  echo "Checking for persistent database on Google Drive..."
63
  rclone copyto "$REMOTE_PATH/.filebrowser.db" "$DB_PATH" --config "$CONFIG_PATH" --drive-skip-shortcuts --drive-acknowledge-abuse $SHARED_FLAG || true
64
 
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
+ # Check if the database has already been initialized (config export succeeds)
69
+ if filebrowser config export -d "$DB_PATH" >/dev/null 2>&1; then
70
+ echo "Database exists. Updating admin password..."
71
+ filebrowser users update admin --password "$FILEBROWSER_PASSWORD" -d "$DB_PATH"
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
79
+
80
  # 2. Download files from Google Drive to local /data directory
81
  echo "Syncing files from Google Drive..."
82
  rclone copy "$REMOTE_PATH" "$DATA_DIR" --config "$CONFIG_PATH" --drive-skip-shortcuts --drive-acknowledge-abuse $SHARED_FLAG || true