Skip to content

ระบบจัดเก็บไฟล์ (Local & S3)

ค่าเริ่มต้น Microbase เก็บไฟล์ไว้ที่ DATA_DIR=./storage และสามารถสลับไปใช้ S3 / Cloudflare R2 / MinIO ได้แบบ live ไม่ต้อง restart

ตั้งค่า S3 ใน microbase.conf

Section titled “ตั้งค่า S3 ใน microbase.conf”
S3_ENABLED=true
S3_ENDPOINT=https://<account>.r2.cloudflarestorage.com
S3_BUCKET=microbase-files
S3_REGION=auto
S3_ACCESS_KEY=your-access-key
S3_SECRET_KEY=your-secret-key
S3_FORCE_PATH_STYLE=true
  • ย่อรูปอัตโนมัติ: GET /api/files/:collection/:recordId/:filename?thumb=300x300 (มี limit ป้องกัน image-bomb DoS)
  • สำหรับไฟล์ใน Collection ที่ต้องล็อกอิน ขอ short-lived token ได้ที่ POST /api/files/token แล้วแนบ ?token=<FILE_TOKEN>