caddypostgresql

package module
v0.0.0-...-34e4b04 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 14 Imported by: 0

README

Caddy Storage PostgreSQL

[!WARNING] This project is still a work in progress, although used by DMARCwise in production.

A storage implementation for Caddy / certmagic that uses PostgreSQL as the backend.

How to use

Build the module into your Caddy binary:

xcaddy build --with github.com/dmarcwise/caddy-storage-postgresql

You can pin a specific commit with:

xcaddy build --with github.com/dmarcwise/caddy-storage-postgresql@<commit-hash>

Configure Caddy to use the PostgreSQL storage module. Example Caddyfile:

{
    storage postgresql {
        dsn "postgres://user:password@localhost:5432/caddy?sslmode=disable"
    }
}

The dsn parameter is a PostgreSQL connection string, either as a key/value string or as a connection URI.

The sslmode connection parameter defaults to require. We recommend setting a statement_timeout (e.g. 30s) and other basic parameters.

This module implementation already sets the following connection pooling parameters:

  • Maximum open connections: 10
  • Maximum idle connections: 3
  • Connection maximum idle time: 1h

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStorage

type PostgresStorage struct {
	Dsn        string `json:"dsn,omitempty"`
	DebugLocks bool   `json:"debug_locks,omitempty"`
	// contains filtered or unexported fields
}

func NewPostgresStorage

func NewPostgresStorage() *PostgresStorage

func (PostgresStorage) CaddyModule

func (PostgresStorage) CaddyModule() caddy.ModuleInfo

func (*PostgresStorage) CertMagicStorage

func (s *PostgresStorage) CertMagicStorage() (certmagic.Storage, error)

func (*PostgresStorage) Cleanup

func (s *PostgresStorage) Cleanup() error

func (*PostgresStorage) Delete

func (s *PostgresStorage) Delete(ctx context.Context, key string) error

func (*PostgresStorage) Exists

func (s *PostgresStorage) Exists(ctx context.Context, key string) bool

func (*PostgresStorage) List

func (s *PostgresStorage) List(ctx context.Context, path string, recursive bool) ([]string, error)

func (*PostgresStorage) Load

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

func (*PostgresStorage) Lock

func (s *PostgresStorage) Lock(ctx context.Context, name string) error

func (*PostgresStorage) Provision

func (s *PostgresStorage) Provision(ctx caddy.Context) error

func (*PostgresStorage) Stat

func (*PostgresStorage) Store

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

func (*PostgresStorage) Unlock

func (s *PostgresStorage) Unlock(ctx context.Context, name string) error

func (*PostgresStorage) UnmarshalCaddyfile

func (s *PostgresStorage) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

Jump to

Keyboard shortcuts

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