Files
storage/CLAUDE.md
T
argoyleandClaude Opus 5.5 c225556976
storage / test (pull_request) Successful in 47s
storage / vulnerabilities (pull_request) Successful in 59s
pre-commit / pre-commit (pull_request) Successful in 4m55s
feat: move module path to git.unbound.se
The module is now git.unbound.se/unboundsoftware/storage. The API is unchanged. Tags up to v0.4.4 declare gitea.unbound.se/unboundsoftware/storage and stay resolvable through that alias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kko4x3MYEcWMMdkx12WpBa
2026-10-17 19:55:00 +02:00

44 lines
1.4 KiB
Markdown

# storage
Standalone Go library for AWS S3 storage operations.
**Note:** This is an independent library, not part of the Shiny ecosystem, though it is currently only used by Shiny services.
## Purpose
Provides standardized S3 object storage utilities with presigned URL generation. Used by services that need to store and serve files (PDFs, images, etc.).
## Usage
```go
import "git.unbound.se/unboundsoftware/storage"
// Option 1: Managed uploads (multipart, 5MB part size) - loads AWS config automatically
s3Storage, err := storage.New("my-bucket")
// Option 2: Direct uploads with custom AWS config
cfg, _ := config.LoadDefaultConfig(context.Background())
s3Storage := storage.NewS3(cfg, "my-bucket")
// Upload and get presigned URL (15-minute expiration)
url, err := s3Storage.Store("path/to/file.pdf", reader, "application/pdf")
```
## Features
- **Managed uploads** (`New`) - Uses upload manager with 5MB multipart chunks for large files
- **Direct uploads** (`NewS3`) - Uses PutObject directly, allows custom AWS config
- **Presigned URLs** - 15-minute expiration for secure access
## Configuration
Uses AWS SDK v2, loading config from:
- Environment variables (`AWS_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
- Shared config files (`~/.aws/config`, `~/.aws/credentials`)
- IAM roles (on AWS infrastructure)
## Development
- Go 1.23+
- Run tests: `go test ./...`