Skip to content

oyato/certmagic-badgerstorage

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

certmagic-badgerstorage

Package badgerstorage implements a certmagic.Storage on top of a Badger database.

It's an alternative to the default file-system storage used by CertMagic.

Install

go get oya.to/certmagic-badgerstorage

Usage

package main

import (
	"github.com/caddyserver/certmagic"
	"github.com/dgraph-io/badger/v2"
	"log"
	"oya.to/certmagic-badgerstorage"
)

func main() {
	// setup the badger DB
	db, err := badger.Open(badger.DefaultOptions("").WithInMemory(true))
	if err != nil {
		log.Fatalf("Cannot open badger memory DB: %s", err)
	}

	// set the default CertMagic storage to replace the file-system based on.
	certmagic.Default.Storage = badgerstorage.New(db)

	// setup the rest of your CertMagic stuff...
}

About

Package oya.to/certmagic-badgerstorage implements certmagic.Storage on top of a badger database.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages