forked from golang/hotime
开始新增代码生成配置2.0功能,配置文件格式规定完成
This commit is contained in:
parent
9cd7ad34b3
commit
47b28e7b57
@ -298,9 +298,13 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
if len(token) == 32 {
|
||||
sessionId = token
|
||||
}
|
||||
//http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId+";SameSite=Strict", Path: "/"})
|
||||
//http.SetCookie(w, &http.Cookie{Name: "SameSite", Value: "Strict", Path: "/"})
|
||||
w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure")
|
||||
//没有跨域设置
|
||||
if that.Config.GetString("crossDomain") == "" {
|
||||
http.SetCookie(w, &http.Cookie{Name: that.Config.GetString("sessionName"), Value: sessionId, Path: "/"})
|
||||
} else {
|
||||
//跨域允许需要设置cookie的允许跨域
|
||||
w.Header().Set("Set-Cookie", that.Config.GetString("sessionName")+"="+sessionId+"; SameSite=None; Secure")
|
||||
}
|
||||
} else {
|
||||
sessionId = cookie.Value
|
||||
}
|
||||
|
7
var.go
7
var.go
@ -14,6 +14,13 @@ var Config = Map{
|
||||
"codeConfig": Map{
|
||||
"admin": "config/app.json",
|
||||
},
|
||||
"codeConfig1": Map{
|
||||
"admin": Map{ //默认无,必须,接口类别名称
|
||||
"package": "admin", //默认admin,非必须,有则生成代码到此目录,无则采用缺省模式不生成代码只生成接口
|
||||
"config": "config/app.json", //默认config/app.json,必须,接口描述配置文件
|
||||
"rule": "config/rule.json", //默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成
|
||||
},
|
||||
},
|
||||
"db": Map{
|
||||
"sqlite": Map{
|
||||
"path": "config/data.db",
|
||||
|
Loading…
Reference in New Issue
Block a user