feat: config, migrations embed, and server entrypoint
- internal/config: typed Config struct loaded from env vars via godotenv; all fields from docs (listen addr, JWT, DB, storage, thumbs, import) - migrations/embed.go: embed FS so goose SQL files are baked into the binary - cmd/server/main.go: load config → connect pgxpool → goose migrations (embedded) → Gin server with GET /health returning 200 OK - .env.example: documents all required and optional env vars - go.mod: bump to Go 1.26, add gin/pgx/goose/godotenv as direct deps Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# =============================================================================
|
||||
# Tanabata File Manager — environment variables
|
||||
# Copy to .env and fill in the values.
|
||||
# =============================================================================
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Server
|
||||
# ---------------------------------------------------------------------------
|
||||
LISTEN_ADDR=:8080
|
||||
JWT_SECRET=change-me-to-a-random-32-byte-secret
|
||||
JWT_ACCESS_TTL=15m
|
||||
JWT_REFRESH_TTL=720h
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Database
|
||||
# ---------------------------------------------------------------------------
|
||||
DATABASE_URL=postgres://tanabata:password@localhost:5432/tanabata?sslmode=disable
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Storage
|
||||
# ---------------------------------------------------------------------------
|
||||
FILES_PATH=/data/files
|
||||
THUMBS_CACHE_PATH=/data/thumbs
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Thumbnails
|
||||
# ---------------------------------------------------------------------------
|
||||
THUMB_WIDTH=160
|
||||
THUMB_HEIGHT=160
|
||||
PREVIEW_WIDTH=1920
|
||||
PREVIEW_HEIGHT=1080
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Import
|
||||
# ---------------------------------------------------------------------------
|
||||
IMPORT_PATH=/data/import
|
||||
Reference in New Issue
Block a user