mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 07:30:50 +00:00
commit
8e6b0a6d7b
4
admin.go
4
admin.go
@ -120,7 +120,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
|
||||
m["BConfig.WebConfig.AutoRender"] = BConfig.WebConfig.AutoRender
|
||||
m["BConfig.WebConfig.EnableDocs"] = BConfig.WebConfig.EnableDocs
|
||||
m["BConfig.WebConfig.FlashName"] = BConfig.WebConfig.FlashName
|
||||
m["BConfig.WebConfig.FlashSeperator"] = BConfig.WebConfig.FlashSeperator
|
||||
m["BConfig.WebConfig.FlashSeparator"] = BConfig.WebConfig.FlashSeparator
|
||||
m["BConfig.WebConfig.DirectoryIndex"] = BConfig.WebConfig.DirectoryIndex
|
||||
m["BConfig.WebConfig.StaticDir"] = BConfig.WebConfig.StaticDir
|
||||
m["BConfig.WebConfig.StaticExtensionsToGzip"] = BConfig.WebConfig.StaticExtensionsToGzip
|
||||
@ -128,7 +128,7 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
|
||||
m["BConfig.WebConfig.TemplateRight"] = BConfig.WebConfig.TemplateRight
|
||||
m["BConfig.WebConfig.ViewsPath"] = BConfig.WebConfig.ViewsPath
|
||||
m["BConfig.WebConfig.EnableXSRF"] = BConfig.WebConfig.EnableXSRF
|
||||
m["BConfig.WebConfig.XSRFKEY"] = BConfig.WebConfig.XSRFKEY
|
||||
m["BConfig.WebConfig.XSRFKEY"] = BConfig.WebConfig.XSRFKey
|
||||
m["BConfig.WebConfig.XSRFExpire"] = BConfig.WebConfig.XSRFExpire
|
||||
m["BConfig.WebConfig.Session.SessionOn"] = BConfig.WebConfig.Session.SessionOn
|
||||
m["BConfig.WebConfig.Session.SessionProvider"] = BConfig.WebConfig.Session.SessionProvider
|
||||
|
12
config.go
12
config.go
@ -63,7 +63,7 @@ type WebConfig struct {
|
||||
AutoRender bool
|
||||
EnableDocs bool
|
||||
FlashName string
|
||||
FlashSeperator string
|
||||
FlashSeparator string
|
||||
DirectoryIndex bool
|
||||
StaticDir map[string]string
|
||||
StaticExtensionsToGzip []string
|
||||
@ -71,7 +71,7 @@ type WebConfig struct {
|
||||
TemplateRight string
|
||||
ViewsPath string
|
||||
EnableXSRF bool
|
||||
XSRFKEY string
|
||||
XSRFKey string
|
||||
XSRFExpire int
|
||||
Session SessionConfig
|
||||
}
|
||||
@ -141,7 +141,7 @@ func init() {
|
||||
AutoRender: true,
|
||||
EnableDocs: false,
|
||||
FlashName: "BEEGO_FLASH",
|
||||
FlashSeperator: "BEEGOFLASH",
|
||||
FlashSeparator: "BEEGOFLASH",
|
||||
DirectoryIndex: false,
|
||||
StaticDir: map[string]string{"/static": "static"},
|
||||
StaticExtensionsToGzip: []string{".css", ".js"},
|
||||
@ -149,7 +149,7 @@ func init() {
|
||||
TemplateRight: "}}",
|
||||
ViewsPath: "views",
|
||||
EnableXSRF: false,
|
||||
XSRFKEY: "beegoxsrf",
|
||||
XSRFKey: "beegoxsrf",
|
||||
XSRFExpire: 0,
|
||||
Session: SessionConfig{
|
||||
SessionOn: false,
|
||||
@ -221,9 +221,9 @@ func ParseConfig() (err error) {
|
||||
BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath)
|
||||
BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex)
|
||||
BConfig.WebConfig.FlashName = AppConfig.DefaultString("FlashName", BConfig.WebConfig.FlashName)
|
||||
BConfig.WebConfig.FlashSeperator = AppConfig.DefaultString("FlashSeperator", BConfig.WebConfig.FlashSeperator)
|
||||
BConfig.WebConfig.FlashSeparator = AppConfig.DefaultString("FlashSeparator", BConfig.WebConfig.FlashSeparator)
|
||||
BConfig.WebConfig.EnableDocs = AppConfig.DefaultBool("EnableDocs", BConfig.WebConfig.EnableDocs)
|
||||
BConfig.WebConfig.XSRFKEY = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKEY)
|
||||
BConfig.WebConfig.XSRFKey = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKey)
|
||||
BConfig.WebConfig.EnableXSRF = AppConfig.DefaultBool("EnableXSRF", BConfig.WebConfig.EnableXSRF)
|
||||
BConfig.WebConfig.XSRFExpire = AppConfig.DefaultInt("XSRFExpire", BConfig.WebConfig.XSRFExpire)
|
||||
BConfig.WebConfig.TemplateLeft = AppConfig.DefaultString("TemplateLeft", BConfig.WebConfig.TemplateLeft)
|
||||
|
@ -29,12 +29,12 @@
|
||||
// cnf.Int64(key string) (int64, error)
|
||||
// cnf.Bool(key string) (bool, error)
|
||||
// cnf.Float(key string) (float64, error)
|
||||
// cnf.DefaultString(key string, defaultval string) string
|
||||
// cnf.DefaultStrings(key string, defaultval []string) []string
|
||||
// cnf.DefaultInt(key string, defaultval int) int
|
||||
// cnf.DefaultInt64(key string, defaultval int64) int64
|
||||
// cnf.DefaultBool(key string, defaultval bool) bool
|
||||
// cnf.DefaultFloat(key string, defaultval float64) float64
|
||||
// cnf.DefaultString(key string, defaultVal string) string
|
||||
// cnf.DefaultStrings(key string, defaultVal []string) []string
|
||||
// cnf.DefaultInt(key string, defaultVal int) int
|
||||
// cnf.DefaultInt64(key string, defaultVal int64) int64
|
||||
// cnf.DefaultBool(key string, defaultVal bool) bool
|
||||
// cnf.DefaultFloat(key string, defaultVal float64) float64
|
||||
// cnf.DIY(key string) (interface{}, error)
|
||||
// cnf.GetSection(section string) (map[string]string, error)
|
||||
// cnf.SaveConfigFile(filename string) error
|
||||
@ -48,19 +48,19 @@ import (
|
||||
|
||||
// Configer defines how to get and set value from configuration raw data.
|
||||
type Configer interface {
|
||||
Set(key, val string) error // support section::key type in given key when using ini type.
|
||||
String(key string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
||||
Set(key, val string) error //support section::key type in given key when using ini type.
|
||||
String(key string) string //support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
||||
Strings(key string) []string //get string slice
|
||||
Int(key string) (int, error)
|
||||
Int64(key string) (int64, error)
|
||||
Bool(key string) (bool, error)
|
||||
Float(key string) (float64, error)
|
||||
DefaultString(key string, defaultval string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
||||
DefaultStrings(key string, defaultval []string) []string //get string slice
|
||||
DefaultInt(key string, defaultval int) int
|
||||
DefaultInt64(key string, defaultval int64) int64
|
||||
DefaultBool(key string, defaultval bool) bool
|
||||
DefaultFloat(key string, defaultval float64) float64
|
||||
DefaultString(key string, defaultVal string) string // support section::key type in key string when using ini and json type; Int,Int64,Bool,Float,DIY are same.
|
||||
DefaultStrings(key string, defaultVal []string) []string //get string slice
|
||||
DefaultInt(key string, defaultVal int) int
|
||||
DefaultInt64(key string, defaultVal int64) int64
|
||||
DefaultBool(key string, defaultVal bool) bool
|
||||
DefaultFloat(key string, defaultVal float64) float64
|
||||
DIY(key string) (interface{}, error)
|
||||
GetSection(section string) (map[string]string, error)
|
||||
SaveConfigFile(filename string) error
|
||||
|
@ -23,7 +23,7 @@ func TestDefaults(t *testing.T) {
|
||||
t.Errorf("FlashName was not set to default.")
|
||||
}
|
||||
|
||||
if BConfig.WebConfig.FlashSeperator != "BEEGOFLASH" {
|
||||
if BConfig.WebConfig.FlashSeparator != "BEEGOFLASH" {
|
||||
t.Errorf("FlashName was not set to default.")
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ func (c *Controller) XSRFToken() string {
|
||||
if c.XSRFExpire > 0 {
|
||||
expire = int64(c.XSRFExpire)
|
||||
}
|
||||
c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKEY, expire)
|
||||
c._xsrfToken = c.Ctx.XSRFToken(BConfig.WebConfig.XSRFKey, expire)
|
||||
}
|
||||
return c._xsrfToken
|
||||
}
|
||||
|
4
flash.go
4
flash.go
@ -83,7 +83,7 @@ func (fd *FlashData) Store(c *Controller) {
|
||||
c.Data["flash"] = fd.Data
|
||||
var flashValue string
|
||||
for key, value := range fd.Data {
|
||||
flashValue += "\x00" + key + "\x23" + BConfig.WebConfig.FlashSeperator + "\x23" + value + "\x00"
|
||||
flashValue += "\x00" + key + "\x23" + BConfig.WebConfig.FlashSeparator + "\x23" + value + "\x00"
|
||||
}
|
||||
c.Ctx.SetCookie(BConfig.WebConfig.FlashName, url.QueryEscape(flashValue), 0, "/")
|
||||
}
|
||||
@ -96,7 +96,7 @@ func ReadFromRequest(c *Controller) *FlashData {
|
||||
vals := strings.Split(v, "\x00")
|
||||
for _, v := range vals {
|
||||
if len(v) > 0 {
|
||||
kv := strings.Split(v, "\x23"+BConfig.WebConfig.FlashSeperator+"\x23")
|
||||
kv := strings.Split(v, "\x23"+BConfig.WebConfig.FlashSeparator+"\x23")
|
||||
if len(kv) == 2 {
|
||||
flash.Data[kv[0]] = kv[1]
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ type ResourceListing struct {
|
||||
APIVersion string `json:"apiVersion"`
|
||||
SwaggerVersion string `json:"swaggerVersion"` // e.g 1.2
|
||||
// BasePath string `json:"basePath"` obsolete in 1.1
|
||||
APIs []APIRef `json:"apis"`
|
||||
Infos Infomation `json:"info"`
|
||||
APIs []APIRef `json:"apis"`
|
||||
Info Information `json:"info"`
|
||||
}
|
||||
|
||||
// APIRef description the api path and description
|
||||
@ -33,8 +33,8 @@ type APIRef struct {
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// Infomation show the API Infomation
|
||||
type Infomation struct {
|
||||
// Information show the API Information
|
||||
type Information struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Contact string `json:"contact,omitempty"`
|
Loading…
Reference in New Issue
Block a user