# Blaze Gallery configuration. # # cp .env.template .env # # Fill the "Photo storage" block, choose how people sign in, and start: # docker compose up -d --build (see docs/SETUP.md for other ways) # # Just want to see it? `cp .env.demo .env` gives a sample library instead. # docs/CONFIGURATION.md describes every variable. Keep .env out of git. # --------------------------------------------------------------------------- # Photo storage (required) # --------------------------------------------------------------------------- # Any S3-compatible bucket: Backblaze B2, Cloudflare R2, MinIO, AWS S3. # The names say BACKBLAZE because B2 came first; nothing else is B2-specific. # # Browsing needs list + read. The app also writes to this bucket when you # upload photos, deletes from it when you delete a photo, and stores # thumbnails in it if THUMBNAIL_STORAGE=s3 without a separate thumbnail # bucket. A read-only key works for browsing; those three actions then fail. # S3 endpoint, with https:// (B2 example; R2: https://.r2.cloudflarestorage.com) BACKBLAZE_ENDPOINT=https://s3.us-west-004.backblazeb2.com BACKBLAZE_BUCKET=your-photo-bucket BACKBLAZE_ACCESS_KEY=your-key-id BACKBLAZE_SECRET_KEY=your-secret-key # Only when browsers reach the bucket at another address than the server # does (MinIO inside docker compose is http://minio:9000 for the server, # http://localhost:9000 for you). Download links are signed for this one. # BACKBLAZE_PUBLIC_ENDPOINT=http://localhost:9000 # --------------------------------------------------------------------------- # Database (required, except with docker compose) # --------------------------------------------------------------------------- # PostgreSQL 13 or newer. docker compose runs its own Postgres and ignores # this line. Elsewhere, create the tables once with `npm run db:migrate` # (the Docker image does it on every start; it changes nothing on an # existing database). DATABASE_URL=postgresql://user:password@localhost:5432/blaze?sslmode=disable # --------------------------------------------------------------------------- # Who can open the gallery (pick one for production) # --------------------------------------------------------------------------- # In production (the Docker image, npm start, Vercel) the API answers 503 # to everything until you choose: Google sign-in, or no sign-in at all. # `npm run dev` never asks. # Option A: Google sign-in, limited to the listed addresses. SETUP_GOOGLE.md # walks through the Google Cloud side. # GOOGLE_AUTH_ENABLED=true # GOOGLE_CLIENT_ID=1234567890-abc.apps.googleusercontent.com # GOOGLE_CLIENT_SECRET=your-client-secret # AUTH_EMAIL_WHITELIST=you@example.com,partner@example.com # Defaults to $NEXT_PUBLIC_APP_URL/api/auth/google/callback # GOOGLE_REDIRECT_URI=https://photos.example.com/api/auth/google/callback # Sign-in session length in seconds (default 86400, one day) # AUTH_SESSION_DURATION=86400 # Option B: no sign-in. Whoever reaches the server can browse, share, # upload and delete. Only behind a VPN, on a LAN, or for the demo. # ALLOW_PUBLIC_ACCESS=true # 32+ random characters (openssl rand -base64 32). Required with Google # sign-in. Also signs the sessions of password-protected shared links: # without it, a guest has to type the password again after every restart. AUTH_SESSION_SECRET= # --------------------------------------------------------------------------- # API key (optional) # --------------------------------------------------------------------------- # Lets scripts and AI assistants call the API with # `Authorization: Bearer ` (or `X-API-Key: `): required by # /api/sync/full, /api/sync/folder and /api/config, and accepted by # /api/mcp instead of a signed-in session. # API_KEY= # A second key, accepted wherever API_KEY is (only while API_KEY is set) # ADMIN_API_KEY= # --------------------------------------------------------------------------- # Public address # --------------------------------------------------------------------------- # The gallery's URL as people type it. In production, Google sign-in and # sign-out only accept requests coming from it. Share links use it when it # is set at build time (npm run build, Vercel); the Docker image is built # without it, so its share links use the address in the browser. NEXT_PUBLIC_APP_URL=http://localhost:3000 # --------------------------------------------------------------------------- # Thumbnails (optional) # --------------------------------------------------------------------------- # Thumbnails (400 px) and viewer renditions (2048 px) are made from the # originals on first view and kept. # local: on disk, under THUMBNAILS_PATH (default ./data/thumbnails; the # Docker image uses /app/data/thumbnails, a volume in compose) # s3: in a bucket, under THUMBNAIL_S3_PREFIX. Needed where the disk # does not persist (Vercel). THUMBNAIL_STORAGE=local # THUMBNAILS_PATH=./data/thumbnails # THUMBNAIL_S3_PREFIX=thumbnails # With THUMBNAIL_STORAGE=s3, thumbnails go to the photo bucket unless all # four of these are set (for example a Cloudflare R2 bucket, free egress). # The key needs read and write on that bucket. # THUMBNAIL_S3_ENDPOINT=https://.r2.cloudflarestorage.com # THUMBNAIL_S3_BUCKET=photo-thumbnails # THUMBNAIL_S3_ACCESS_KEY= # THUMBNAIL_S3_SECRET_KEY= # Photos larger than this (MB) get no automatic thumbnail; RAW files are # exempt (their embedded preview is used). Default 30. # AUTO_THUMBNAIL_THRESHOLD_MB=30 # The cleanup job (POST /api/sync/cleanup) deletes thumbnails older than # this many days; they are rebuilt on the next view. Default 30. # THUMBNAIL_MAX_AGE_DAYS=30 # --------------------------------------------------------------------------- # S3 audit log (optional) # --------------------------------------------------------------------------- # Storage calls are recorded in the database (Admin > Audit). A daily job # deletes old entries; it needs a long-running server (Docker, npm start). # AUDIT_CLEANUP_ENABLED=true # AUDIT_RETENTION_DAYS=30 # AUDIT_CLEANUP_SCHEDULE=0 2 * * * # Bucket name written on the audit entries of thumbnail requests # B2_BUCKET_NAME= # --------------------------------------------------------------------------- # Logs # --------------------------------------------------------------------------- # DEBUG, INFO, WARN or ERROR (default INFO) LOG_LEVEL=INFO NEXT_TELEMETRY_DISABLED=1 # --------------------------------------------------------------------------- # docker compose only # --------------------------------------------------------------------------- # Host port of the gallery (default 3000) # BLAZE_PORT=3000 # Password of the compose Postgres, set before its first start (default "blaze"; # the database is not published outside the compose network) # POSTGRES_PASSWORD=