~benthor/lunokhod

8342248bf9b3da766a00ce7a9e070c8b3081f4d7 — Benthor 1 year, 5 months ago e1f1497
be verbose about certificate loading and storing
1 files changed, 6 insertions(+), 0 deletions(-)

M main.go
M main.go => main.go +6 -0
@@ 312,17 312,23 @@ func loadCert(domain, name string, store *diskv.Diskv) (cert tls.Certificate, er
func getCert(domain, name string, ctype crypto.CryptoType, store *diskv.Diskv) (cert tls.Certificate, err error) {
	cert, err = loadCert(domain, name, store)
	if err != nil {
		log.Printf("didn't find certificate for domain '%s' with name '%s' in store, generating type %d cert", domain, name, ctype)
		var tmp crypto.Cert
		tmp, err = crypto.Generate(domain, ctype)
		if err != nil {
			log.Printf("could not generate certificate")
			return
		}
		log.Printf("storing generated certificate")
		err = storeCert(domain, name, store, tmp)
		if err != nil {
			log.Printf("storing of generated certificate failed")
			return
		}
		log.Printf("loading the certificate from store")
		return loadCert(domain, name, store)
	}
	log.Printf("loaded certificate for domain '%s' with name '%s' from store", domain, name)
	return
}