Skip to content

About

An implementation of certmagic's Storage interface for CockroachDB.

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Repository files navigation

certmagic-storage-crdb

GoDoc

An implementation of certmagic's Storage interface for CockroachDB.

See tables.sql for the expected tables in the database.

Usage

package main

import (
	"context"
	"log"

	"github.com/caddyserver/certmagic"
	crdb "github.com/maragudk/certmagic-storage-crdb"
)

func main() {
	s := crdb.New(crdb.Options{
		User:     "certmagic",
		Host:     "localhost",
		Port:     26257,
		Database: "certmagic",
		Cert:     "path/to/cert",
		Key:      "path/to/key",
		RootCert: "path/to/root/cert",
	})
	certmagic.Default.Storage = s
	if err := s.Connect(context.Background()); err != nil {
		log.Fatalln("Error connecting to storage:", err)
	}

	err := certmagic.HTTPS([]string{"example.com"}, nil)
}

Limitations

List and Stat behave a bit differently than the default filesystem implementation, in that they only support terminal keys, i.e. keys that have data. The filesystem implementation, in contrast, has directories that can be traversed. This currently has no implications on certmagic, so you can safely use this implementation.

This may change in a later version, if needed.

About

An implementation of certmagic's Storage interface for CockroachDB.

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

⌂ 换网址