From 534427f2b1e0a581da7ffc1d649382ec2e1a3021 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Thu, 8 Jan 2026 14:09:14 +0100 Subject: [PATCH] feat: add Gitea Actions workflow --- .gitea/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ CLAUDE.md | 36 +++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..0c9beb0 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -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 ./... diff --git a/CLAUDE.md b/CLAUDE.md index a5b8a66..c0c0c33 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 ./...`