feat: add Gitea Actions workflow #40
@@ -0,0 +1,30 @@
|
||||
name: storage
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: stable
|
||||
- name: Run tests
|
||||
run: go test -race -coverprofile=coverage.txt ./...
|
||||
|
||||
vulnerabilities:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: stable
|
||||
- name: Check vulnerabilities
|
||||
run: |
|
||||
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
govulncheck ./...
|
||||
@@ -1,41 +1,43 @@
|
||||
# storage
|
||||
|
||||
Shared Go library for AWS S3 storage operations.
|
||||
Standalone Go library for AWS S3 storage operations.
|
||||
|
||||
## Shared Documentation
|
||||
**Note:** This is an independent library, not part of the Shiny ecosystem, though it is currently only used by Shiny services.
|
||||
|
||||
@../docs/claude/architecture.md
|
||||
@../docs/claude/go-services.md
|
||||
@../docs/claude/conventions.md
|
||||
|
||||
## Library Information
|
||||
|
||||
### Purpose
|
||||
## 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
|
||||
## Usage
|
||||
|
||||
```go
|
||||
import "gitlab.com/unboundsoftware/shiny/storage"
|
||||
import "gitlab.com/unboundsoftware/storage"
|
||||
|
||||
// Create storage with automatic AWS config
|
||||
// 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
|
||||
## Features
|
||||
|
||||
- **Managed uploads** - For large files with multipart upload
|
||||
- **Direct uploads** - For smaller files or custom config
|
||||
- **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
|
||||
- **Configurable part size** - For multipart upload optimization
|
||||
|
||||
### Configuration
|
||||
## 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 ./...`
|
||||
|
||||
Reference in New Issue
Block a user