Skip to content

Commit 5b6ccbc

Browse files
authored
Merge pull request #207 from devfeel/develop
Version 1.6.8 - Remove OfflineServer & Remove render\developmode\start examples
2 parents b7cb26b + 74c58fe commit 5b6ccbc

15 files changed

Lines changed: 29 additions & 294 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ func TestBind(ctx dotweb.HttpContext) error{
208208
* [CORS](https://github.com/devfeel/middleware/tree/master/cors) - [example](https://github.com/devfeel/middleware/tree/master/example/cors)
209209
* [Gzip](https://github.com/devfeel/middleware/tree/master/gzip) - [example](https://github.com/devfeel/middleware/tree/master/example/gzip)
210210
* [authorization based on Casbin](https://github.com/devfeel/middleware/tree/master/authz) - [example](https://github.com/devfeel/middleware/tree/master/example/authz) - [what's Casbin?](https://github.com/casbin/casbin)
211-
* BasicAuth
211+
* [BasicAuth](https://github.com/devfeel/middleware/tree/master/basicauth) - [example](https://github.com/devfeel/middleware/tree/master/example/basicauth)
212+
* [Domain](https://github.com/devfeel/middleware/tree/master/domain) - [example](https://github.com/devfeel/middleware/tree/master/example/domain)
212213
* Recover
213214
* HeaderOverride
214215

@@ -323,9 +324,6 @@ dependency now managed by go mod.
323324
#### <a href="https://github.com/devfeel/dotweb-start" target="_blank">dotweb-start</a>
324325
项目简介:基于dotweb、dotlog、mapper、dottask、cache、database的综合项目模板。
325326

326-
## 贡献名单
327-
目前已经有几位朋友在为框架一起做努力,我们将在合适的时间向大家展现,谢谢他们的支持!
328-
329327
## Contact Us
330328
#### QQ-Group:193409346 - <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=836e11667837ad674462a4a97fb21fba487cd3dff5b2e1ca0d7ea4c2324b4574"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Golang-Devfeel" title="Golang-Devfeel"></a>
331329
#### Gitter:[![Gitter](https://badges.gitter.im/devfeel/dotweb.svg)](https://gitter.im/devfeel-dotweb/wechat)

config/configs.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type (
1616
XMLName xml.Name `xml:"config" json:"-" yaml:"-"`
1717
App *AppNode `xml:"app"`
1818
ConfigSetNodes []*ConfigSetNode `xml:"configset>set"`
19-
Offline *OfflineNode `xml:"offline"`
2019
Server *ServerNode `xml:"server"`
2120
Session *SessionNode `xml:"session"`
2221
Routers []*RouterNode `xml:"routers>router"`
@@ -25,13 +24,6 @@ type (
2524
ConfigSet core.ReadonlyMap `json:"-" yaml:"-"`
2625
}
2726

28-
// OfflineNode dotweb app offline config
29-
OfflineNode struct {
30-
Offline bool `xml:"offline,attr"` // maintenance mode, default false
31-
OfflineText string `xml:"offlinetext,attr"` // text to display when Offline is true, OfflineUrl is used if set
32-
OfflineUrl string `xml:"offlineurl,attr"` // maintenance page url
33-
}
34-
3527
// AppNode dotweb app global config
3628
AppNode struct {
3729
LogPath string `xml:"logpath,attr"` // path of log files, use current directory if empty
@@ -108,7 +100,6 @@ const (
108100
func NewConfig() *Config {
109101
return &Config{
110102
App: NewAppNode(),
111-
Offline: NewOfflineNode(),
112103
Server: NewServerNode(),
113104
Session: NewSessionNode(),
114105
ConfigSet: core.NewReadonlyMap(),
@@ -148,11 +139,6 @@ func NewAppNode() *AppNode {
148139
return config
149140
}
150141

151-
func NewOfflineNode() *OfflineNode {
152-
config := &OfflineNode{}
153-
return config
154-
}
155-
156142
func NewServerNode() *ServerNode {
157143
config := &ServerNode{}
158144
return config
@@ -224,10 +210,6 @@ func InitConfig(configFile string, confType ...interface{}) (config *Config, err
224210
config.Session = NewSessionNode()
225211
}
226212

227-
if config.Offline == nil {
228-
config.Offline = NewOfflineNode()
229-
}
230-
231213
tmpConfigSetMap := core.NewConcurrenceMap()
232214
for _, v := range config.ConfigSetNodes {
233215
tmpConfigSetMap.Set(v.Key, v.Value)

consts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dotweb
33
// Global define
44
const (
55
// Version current version
6-
Version = "1.6.7"
6+
Version = "1.6.8"
77
)
88

99
// Log define

dotweb.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ import (
1919
"github.com/devfeel/dotweb/config"
2020
"github.com/devfeel/dotweb/core"
2121
"github.com/devfeel/dotweb/logger"
22-
"github.com/devfeel/dotweb/servers"
2322
"github.com/devfeel/dotweb/session"
2423
)
2524

2625
type (
2726
DotWeb struct {
2827
HttpServer *HttpServer
2928
cache cache.Cache
30-
OfflineServer servers.Server
3129
Config *config.Config
3230
Mock Mock
3331
Middlewares []Middleware
@@ -81,7 +79,6 @@ const (
8179
func New() *DotWeb {
8280
app := &DotWeb{
8381
HttpServer: NewHttpServer(),
84-
OfflineServer: servers.NewOfflineServer(),
8582
Middlewares: make([]Middleware, 0),
8683
Items: core.NewConcurrenceMap(),
8784
Config: config.NewConfig(),
@@ -385,12 +382,6 @@ func (app *DotWeb) initAppConfig() {
385382

386383
app.HttpServer.initConfig()
387384

388-
// maintenance mode
389-
if config.Offline.Offline {
390-
app.HttpServer.SetOffline(config.Offline.Offline, config.Offline.OfflineText, config.Offline.OfflineUrl)
391-
app.OfflineServer.SetOffline(config.Offline.Offline, config.Offline.OfflineText, config.Offline.OfflineUrl)
392-
}
393-
394385
// detailed request metrics
395386
if config.Server.EnabledDetailRequestData {
396387
app.StateInfo().EnabledDetailRequestData = config.Server.EnabledDetailRequestData

example/developmode/main.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

example/render/main.go

Lines changed: 0 additions & 75 deletions
This file was deleted.

example/render/testview.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

example/start/main.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ go 1.12
44

55
require (
66
github.com/garyburd/redigo v1.6.0
7-
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 // indirect
7+
golang.org/x/net v0.0.0-20190603091049-60506f45cf65
88
gopkg.in/yaml.v2 v2.2.2
99
)

server.go

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,33 +152,27 @@ func (server *HttpServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
152152
} else {
153153
// setup header
154154
w.Header().Set(HeaderServer, DefaultServerName)
155-
// maintenance mode
156-
if server.IsOffline() {
157-
server.DotApp.OfflineServer.ServeHTTP(w, req)
158-
} else {
159-
httpCtx := prepareHttpContext(server, w, req)
160-
161-
// process OnBeginRequest of modules
162-
for _, module := range server.Modules {
163-
if module.OnBeginRequest != nil {
164-
module.OnBeginRequest(httpCtx)
165-
}
155+
httpCtx := prepareHttpContext(server, w, req)
156+
// process OnBeginRequest of modules
157+
for _, module := range server.Modules {
158+
if module.OnBeginRequest != nil {
159+
module.OnBeginRequest(httpCtx)
166160
}
161+
}
167162

168-
if !httpCtx.IsEnd() {
169-
server.Router().ServeHTTP(httpCtx)
170-
}
163+
if !httpCtx.IsEnd() {
164+
server.Router().ServeHTTP(httpCtx)
165+
}
171166

172-
// process OnEndRequest of modules
173-
for _, module := range server.Modules {
174-
if module.OnEndRequest != nil {
175-
module.OnEndRequest(httpCtx)
176-
}
167+
// process OnEndRequest of modules
168+
for _, module := range server.Modules {
169+
if module.OnEndRequest != nil {
170+
module.OnEndRequest(httpCtx)
177171
}
178-
server.StateInfo().AddRequestCount(httpCtx.Request().Path(), httpCtx.Response().HttpCode(), 1)
179-
180-
releaseHttpContext(server, httpCtx)
181172
}
173+
server.StateInfo().AddRequestCount(httpCtx.Request().Path(), httpCtx.Response().HttpCode(), 1)
174+
175+
releaseHttpContext(server, httpCtx)
182176
}
183177
}
184178

0 commit comments

Comments
 (0)