Skip to content

GCS Cache implements the autocet.Cache interface using Google Cloud Storage.

License

Notifications You must be signed in to change notification settings

topos-ai/gcscache

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GCS Cache

Go Report Card GoDoc

GCS Cache implements the autocet.Cache interface using Google Cloud Storage.

Example Usage

package main

import (
    "crypto/tls"
    "log"
    "net/http"

    "github.com/kelseyhightower/gcscache"
    "golang.org/x/crypto/acme/autocert"
)

func main() {
    cache, err := gcscache.New("bucket")
    if err != nil {
        log.Fatal(err)
    }

    m := autocert.Manager{
        Cache:      cache,
        Prompt:     autocert.AcceptTOS,
        HostPolicy: autocert.HostWhitelist("example.org"),
    }

    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Autocert with Google Cloud Storage Cache"))
    })

    s := &http.Server{
        Addr:      "0.0.0.0:443",
        Handler:   mux,
        TLSConfig: &tls.Config{GetCertificate: m.GetCertificate},
    }

    s.ListenAndServeTLS("", "")
}

About

GCS Cache implements the autocet.Cache interface using Google Cloud Storage.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%