feat: add private r2 bucket

This commit is contained in:
Krispire Admin
2026-08-29 01:11:22 +05:30
parent 623935df22
commit 3b10e726b7
12 changed files with 731 additions and 14 deletions
+8
View File
@@ -37,6 +37,13 @@ type Config struct {
R2Bucket string
R2PublicURL string // Public base URL for objects, e.g. https://cdn.example.com or the R2 public bucket URL
// R2PrivateBucket is a SEPARATE bucket with no public access, used for
// objects that must never be fetchable by URL alone (DM attachments).
// A prefix inside R2Bucket would not do: R2 public access is per-bucket,
// so anything in that bucket is world-readable. Empty disables the
// private-media endpoints (they return 503) — the BFF still boots.
R2PrivateBucket string
// SMTP — used for password-reset, email-verification, and
// /feedback admin-notification mails.
SMTPHost string
@@ -136,6 +143,7 @@ func Load() (*Config, error) {
R2SecretAccessKey: getEnv("R2_SECRET_ACCESS_KEY", ""),
R2Bucket: getEnv("R2_BUCKET", ""),
R2PublicURL: getEnv("R2_PUBLIC_URL", ""),
R2PrivateBucket: getEnv("R2_PRIVATE_BUCKET", ""),
SMTPHost: getEnv("SMTP_HOST", ""),
SMTPPort: getEnvInt("SMTP_PORT", 587),