feat: Gnuboard5 Cloudflare R2 Storage Module
- R2StorageAdapter: S3 호환 클라이언트 래퍼
- R2FileHandler: 그누보드 통합 핸들러
- Presigned URL 지원
- 유저별 경로 분리 (users/{member_id}/...)
- 대용량 파일 멀티파트 업로드 지원
- 로컬 스토리지 폴백
- DB 마이그레이션 스크립트 포함
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
66
extend/r2-storage/r2_config.php
Normal file
66
extend/r2-storage/r2_config.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Cloudflare R2 Storage Configuration
|
||||
*
|
||||
* 이 파일을 복사하여 실제 값으로 수정하세요.
|
||||
* r2_config.php.example -> r2_config.php
|
||||
*/
|
||||
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
// ============================================
|
||||
// Cloudflare R2 Credentials
|
||||
// ============================================
|
||||
// Cloudflare Dashboard > R2 > Manage R2 API Tokens 에서 생성
|
||||
define('R2_ACCOUNT_ID', 'your_account_id_here');
|
||||
define('R2_ACCESS_KEY_ID', 'your_access_key_id_here');
|
||||
define('R2_SECRET_ACCESS_KEY', 'your_secret_access_key_here');
|
||||
|
||||
// ============================================
|
||||
// Bucket Settings
|
||||
// ============================================
|
||||
define('R2_BUCKET_NAME', 'gnuboard-files');
|
||||
define('R2_ENDPOINT', 'https://' . R2_ACCOUNT_ID . '.r2.cloudflarestorage.com');
|
||||
|
||||
// Public URL (CDN 또는 Public Bucket URL)
|
||||
// 예: https://pub-xxxxx.r2.dev 또는 Custom Domain
|
||||
define('R2_PUBLIC_URL', '');
|
||||
|
||||
// ============================================
|
||||
// Storage Options
|
||||
// ============================================
|
||||
// R2 스토리지 활성화 여부
|
||||
define('R2_ENABLED', true);
|
||||
|
||||
// Presigned URL 사용 여부 (권장: true)
|
||||
define('R2_USE_PRESIGNED_URL', true);
|
||||
|
||||
// Presigned URL 만료 시간 (초) - 기본 1시간
|
||||
define('R2_PRESIGNED_EXPIRY', 3600);
|
||||
|
||||
// 대용량 파일 멀티파트 업로드 임계값 (bytes) - 기본 100MB
|
||||
define('R2_MULTIPART_THRESHOLD', 100 * 1024 * 1024);
|
||||
|
||||
// R2 연결 실패 시 로컬 저장 폴백
|
||||
define('R2_FALLBACK_TO_LOCAL', true);
|
||||
|
||||
// ============================================
|
||||
// Path Prefix Settings
|
||||
// ============================================
|
||||
// 유저별 경로 사용 여부
|
||||
define('R2_USE_USER_PREFIX', true);
|
||||
|
||||
// 기본 경로 구조
|
||||
// {user_id} - 회원 ID
|
||||
// {bo_table} - 게시판 테이블명
|
||||
// {date} - 날짜 (Y-m-d)
|
||||
define('R2_PATH_BOARD', 'users/{user_id}/board/{bo_table}');
|
||||
define('R2_PATH_EDITOR', 'users/{user_id}/editor/{date}');
|
||||
define('R2_PATH_PROFILE', 'users/{user_id}/profile');
|
||||
define('R2_PATH_PUBLIC', 'public/board/{bo_table}');
|
||||
|
||||
// ============================================
|
||||
// Allowed File Types
|
||||
// ============================================
|
||||
define('R2_ALLOWED_IMAGE_EXT', 'jpg,jpeg,gif,png,webp,svg');
|
||||
define('R2_ALLOWED_FILE_EXT', 'jpg,jpeg,gif,png,webp,svg,pdf,doc,docx,xls,xlsx,ppt,pptx,hwp,txt,zip,rar,7z');
|
||||
Reference in New Issue
Block a user