From ef5685bf7eeb33fcf0b840adf7bdc4219132d198 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 23 Aug 2020 17:55:29 +0300 Subject: [PATCH] add Iris + Serverless example link --- README.md | 2 +- _examples/README.md | 1 + core/host/supervisor.go | 5 ++++- core/host/task.go | 2 +- core/router/handler.go | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9b40c6e6..ba2d2253 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ For a more detailed technical documentation you can head over to our [godocs](ht [![follow Iris web framework on facebook](https://img.shields.io/badge/Follow%20%40Iris.framework-450-2D88FF.svg?style=for-the-badge&logo=facebook)](https://www.facebook.com/iris.framework) -You can [request](https://iris-go.com/#book) a PDF version and online access of the **E-Book** today and be participated in the development of Iris. +You can [request](https://www.iris-go.com/#ebookDonateForm) a PDF version and online access of the **E-Book** today and be participated in the development of Iris. ## 🙌 Contributing diff --git a/_examples/README.md b/_examples/README.md index 6cdadd66..ed88f16c 100644 --- a/_examples/README.md +++ b/_examples/README.md @@ -1,5 +1,6 @@ # Table of Contents +* [Serverless](https://github.com/iris-contrib/gateway#netlify) * [REST API for Apache Kafka](kafka-api) * [URL Shortener](url-shortener) * [Dropzone.js](dropzonejs) diff --git a/core/host/supervisor.go b/core/host/supervisor.go index 8057fd06..5c3fef7e 100644 --- a/core/host/supervisor.go +++ b/core/host/supervisor.go @@ -37,7 +37,8 @@ type Supervisor struct { closedManually uint32 // future use, accessed atomically (non-zero means we've called the Shutdown) closedByInterruptHandler uint32 // non-zero means that the end-developer interrupted it by-purpose. manuallyTLS bool // we need that in order to determinate what to output on the console before the server begin. - shouldWait int32 // non-zero means that the host should wait for unblocking + autoTLS bool + shouldWait int32 // non-zero means that the host should wait for unblocking unblockChan chan struct{} mu sync.Mutex @@ -355,6 +356,8 @@ func (su *Supervisor) ListenAndServeAutoTLS(domain string, email string, cacheDi hostPolicy = autocert.HostWhitelist(domains...) } + su.autoTLS = true + autoTLSManager := &autocert.Manager{ Prompt: autocert.AcceptTOS, HostPolicy: hostPolicy, diff --git a/core/host/task.go b/core/host/task.go index 7a4f030d..39571eb7 100644 --- a/core/host/task.go +++ b/core/host/task.go @@ -22,7 +22,7 @@ import ( // This function should be registered on Serve. func WriteStartupLogOnServe(w io.Writer) func(TaskHost) { return func(h TaskHost) { - guessScheme := netutil.ResolveScheme(h.Supervisor.manuallyTLS || h.Supervisor.Fallback != nil) + guessScheme := netutil.ResolveScheme(h.Supervisor.autoTLS || h.Supervisor.manuallyTLS || h.Supervisor.Fallback != nil) addr := h.Supervisor.FriendlyAddr if addr == "" { addr = h.Supervisor.Server.Addr diff --git a/core/router/handler.go b/core/router/handler.go index c034a225..5dd51543 100644 --- a/core/router/handler.go +++ b/core/router/handler.go @@ -138,6 +138,7 @@ func defaultErrorHandler(ctx *context.Context) { func (h *routerHandler) Build(provider RoutesProvider) error { h.trees = h.trees[0:0] // reset, inneed when rebuilding. + h.errorTrees = h.errorTrees[0:0] // set the default error code handler, will be fired on error codes // that are not handled by a specific handler (On(Any)ErrorCode).