aboutsummaryrefslogtreecommitdiff
path: root/examples/server.go
diff options
context:
space:
mode:
authoradnano <[email protected]>2020-10-17 11:57:11 -0400
committeradnano <[email protected]>2020-10-17 11:57:11 -0400
commit960ebd9b46c1174953a58f959f118b4d998fe193 (patch)
treeade4f15a29ede8aaebddb65d401e1f32dd30662e /examples/server.go
parentAdd (Text).HTML function to render text to HTML (diff)
downloadgo-gemini-960ebd9b46c1174953a58f959f118b4d998fe193.tar.xz
go-gemini-960ebd9b46c1174953a58f959f118b4d998fe193.zip
examples/server: Create certificates if they does not exist
Diffstat (limited to 'examples/server.go')
-rw-r--r--examples/server.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/server.go b/examples/server.go
index c3b1e39..c1c45bb 100644
--- a/examples/server.go
+++ b/examples/server.go
@@ -24,8 +24,11 @@ func main() {
if err != nil {
switch err {
case gmi.ErrCertificateExpired:
+ // Generate a new certificate if the current one is expired.
log.Print("Old certificate expired, creating new one")
- // Generate a new certificate if the old one is expired.
+ fallthrough
+ case gmi.ErrCertificateUnknown:
+ // Generate a certificate if one does not exist.
cert, err := gmi.NewCertificate(hostname, time.Minute)
if err != nil {
// Failed to generate new certificate, abort