mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:16:28 +01:00
friendly name displayed on AutoTLS as suggested at #1578
This commit is contained in:
parent
22e25c3586
commit
0edf0affb0
|
@ -31,6 +31,7 @@ type Configurator func(su *Supervisor)
|
||||||
// Interfaces are separated to return relative functionality to them.
|
// Interfaces are separated to return relative functionality to them.
|
||||||
type Supervisor struct {
|
type Supervisor struct {
|
||||||
Server *http.Server
|
Server *http.Server
|
||||||
|
friendlyAddr string // e.g mydomain.com instead of :443 when AutoTLS is used, see `WriteStartupLogOnServe` task.
|
||||||
disableHTTP1ToHTTP2Redirection bool
|
disableHTTP1ToHTTP2Redirection bool
|
||||||
closedManually uint32 // future use, accessed atomically (non-zero means we've called the Shutdown)
|
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.
|
closedByInterruptHandler uint32 // non-zero means that the end-developer interrupted it by-purpose.
|
||||||
|
@ -347,8 +348,9 @@ func (su *Supervisor) ListenAndServeAutoTLS(domain string, email string, cacheDi
|
||||||
cache = autocert.DirCache(cacheDir)
|
cache = autocert.DirCache(cacheDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
if domain != "" {
|
if strings.TrimSpace(domain) != "" {
|
||||||
domains := strings.Split(domain, " ")
|
domains := strings.Split(domain, " ")
|
||||||
|
su.friendlyAddr = domains[0]
|
||||||
hostPolicy = autocert.HostWhitelist(domains...)
|
hostPolicy = autocert.HostWhitelist(domains...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,12 @@ import (
|
||||||
// This function should be registered on Serve.
|
// This function should be registered on Serve.
|
||||||
func WriteStartupLogOnServe(w io.Writer) func(TaskHost) {
|
func WriteStartupLogOnServe(w io.Writer) func(TaskHost) {
|
||||||
return func(h TaskHost) {
|
return func(h TaskHost) {
|
||||||
guessScheme := netutil.ResolveScheme(h.Supervisor.manuallyTLS)
|
guessScheme := netutil.ResolveScheme(h.Supervisor.manuallyTLS || h.Supervisor.Fallback != nil)
|
||||||
listeningURI := netutil.ResolveURL(guessScheme, h.Supervisor.Server.Addr)
|
addr := h.Supervisor.friendlyAddr
|
||||||
|
if addr == "" {
|
||||||
|
addr = h.Supervisor.Server.Addr
|
||||||
|
}
|
||||||
|
listeningURI := netutil.ResolveURL(guessScheme, addr)
|
||||||
interruptkey := "CTRL"
|
interruptkey := "CTRL"
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
interruptkey = "CMD"
|
interruptkey = "CMD"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user