s3

package module
v0.0.0-...-a4f9328 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

Caddy S3

This is a super basic dead simple S3 storage module for use with Caddy.

It's based on this repo, but I made it much more bare-bones and updated it because I was having issues using it with Caddy in govcloud.

Want encrypted certs? Too bad, go to the original repo I linked. Want auth via AWS Client Access ID/Secret Key ? Too bad, go to the original I linked.

This is as simple as possible so that I can get something working.

I believe the caddyfile syntax to use it should be like this

storage s3 {
  bucket "your-bucket-name"
  region "your-bucket-region"
}

Auth

This module relies on AWS auth that it can get from context.Background(). I plan to use this module via an IAM role I have attached to my EC2 instance that is running caddy.

Testing

I should add absolutey add unit tests, but I haven't.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LockExpiration   = 2 * time.Minute
	LockPollInterval = 1 * time.Second
	LockTimeout      = 15 * time.Second
)
View Source
var ErrInvalidKey = errors.New("invalid key")

Functions

This section is empty.

Types

type S3

type S3 struct {
	Logger *zap.Logger
	Client *s3sdk.Client
	Bucket string `json:"bucket"`
	Region string `json:"region"`
}

func (S3) CaddyModule

func (s3 S3) CaddyModule() caddy.ModuleInfo

func (S3) CertMagicStorage

func (s3 S3) CertMagicStorage() (certmagic.Storage, error)

func (*S3) Delete

func (s3 *S3) Delete(ctx context.Context, key string) error

func (*S3) Exists

func (s3 *S3) Exists(ctx context.Context, key string) bool

func (*S3) List

func (s3 *S3) List(ctx context.Context, prefix string, recursive bool) ([]string, error)

func (*S3) Load

func (s3 *S3) Load(ctx context.Context, key string) ([]byte, error)

func (*S3) Lock

func (s3 *S3) Lock(ctx context.Context, key string) error

func (*S3) Provision

func (s3 *S3) Provision(ctx caddy.Context) error

func (*S3) Stat

func (s3 *S3) Stat(ctx context.Context, key string) (certmagic.KeyInfo, error)

func (*S3) Store

func (s3 *S3) Store(ctx context.Context, key string, value []byte) error

func (*S3) Unlock

func (s3 *S3) Unlock(ctx context.Context, key string) error

func (*S3) UnmarshalCaddyfile

func (s3 *S3) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

fragile but works for me which is what I wanted

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL