go.mod updates; add search path configuration in file for package ghttp.Server

This commit is contained in:
John 2020-02-16 16:34:30 +08:00
parent 36403fdc08
commit 52943b283c
3 changed files with 13 additions and 2 deletions

1
go.mod
View File

@ -5,7 +5,6 @@ go 1.11
require (
github.com/BurntSushi/toml v0.3.1
github.com/clbanning/mxj v1.8.4
github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e // indirect
github.com/fatih/structs v1.1.0
github.com/fsnotify/fsnotify v1.4.7
github.com/gf-third/mysql v1.4.2

View File

@ -11,6 +11,8 @@ import (
"errors"
"fmt"
"github.com/gogf/gf/debug/gdebug"
"github.com/gogf/gf/internal/intlog"
"github.com/gogf/gf/util/gutil"
"net/http"
"os"
"reflect"
@ -338,7 +340,10 @@ func (s *Server) Start() error {
}
})
}
if intlog.IsInGFDevelop() {
intlog.Print("server configuration:")
gutil.Dump(s.config)
}
s.dumpRouterMap()
return nil
}

View File

@ -139,6 +139,13 @@ func (s *Server) SetConfig(c ServerConfig) error {
if c.ServerRoot != "" {
s.SetServerRoot(c.ServerRoot)
}
if len(c.SearchPaths) > 0 {
paths := c.SearchPaths
c.SearchPaths = []string{}
for _, v := range paths {
s.AddSearchPath(v)
}
}
// HTTPS.
if c.TLSConfig == nil && c.HTTPSCertPath != "" {
s.EnableHTTPS(c.HTTPSCertPath, c.HTTPSKeyPath)