Adds default config variable

This commit is contained in:
Manu Mtz-Almeida 2014-07-04 16:59:57 +02:00
parent 493008ea3c
commit b5db76b87a

12
gin.go
View File

@ -68,6 +68,13 @@ type (
} }
) )
var (
DefaultConfig = Config{
CacheSize: 1024,
Preallocated: 512,
}
)
func (a ErrorMsgs) String() string { func (a ErrorMsgs) String() string {
var buffer bytes.Buffer var buffer bytes.Buffer
for i, msg := range a { for i, msg := range a {
@ -101,10 +108,7 @@ func NewWithConfig(config Config) *Engine {
// Returns a new blank Engine instance without any middleware attached. // Returns a new blank Engine instance without any middleware attached.
// The most basic configuration // The most basic configuration
func New() *Engine { func New() *Engine {
return NewWithConfig(Config{ return NewWithConfig(DefaultConfig)
CacheSize: 1024,
Preallocated: 512,
})
} }
// Returns a Engine instance with the Logger and Recovery already attached. // Returns a Engine instance with the Logger and Recovery already attached.