42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
# storage
|
|
|
|
Shared Go library for AWS S3 storage operations.
|
|
|
|
## Shared Documentation
|
|
|
|
@../docs/claude/architecture.md
|
|
@../docs/claude/go-services.md
|
|
@../docs/claude/conventions.md
|
|
|
|
## Library Information
|
|
|
|
### 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 "gitlab.com/unboundsoftware/shiny/storage"
|
|
|
|
// Create storage with automatic AWS config
|
|
s3Storage, err := storage.New("my-bucket")
|
|
|
|
// Upload and get presigned URL (15-minute expiration)
|
|
url, err := s3Storage.Store("path/to/file.pdf", reader, "application/pdf")
|
|
```
|
|
|
|
### Features
|
|
|
|
- **Managed uploads** - For large files with multipart upload
|
|
- **Direct uploads** - For smaller files or custom config
|
|
- **Presigned URLs** - 15-minute expiration for secure access
|
|
- **Configurable part size** - For multipart upload optimization
|
|
|
|
### 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)
|