mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 13:05:56 +00:00
Update to v4.0.0-alpha.1
This commit is contained in:
@@ -6,6 +6,13 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// Charset character encoding for template rendering
|
||||
Charset = "UTF-8"
|
||||
)
|
||||
|
||||
var (
|
||||
// TimeFormat default time format for any kind of datetime parsing
|
||||
TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
|
||||
// StaticCacheDuration expiration duration for INACTIVE file handlers
|
||||
StaticCacheDuration = 20 * time.Second
|
||||
// CompressedFileSuffix is the suffix to add to the name of
|
||||
@@ -13,4 +20,14 @@ var (
|
||||
//
|
||||
// Defaults to iris-fasthttp.gz
|
||||
CompressedFileSuffix = "iris-fasthttp.gz"
|
||||
|
||||
// ContentTypeHTML defaults to text/html but you can change it, changes the template's content type also
|
||||
ContentTypeHTML = "text/html"
|
||||
)
|
||||
|
||||
const (
|
||||
// NoLayout to disable layout for a particular template file
|
||||
NoLayout = "@.|.@iris_no_layout@.|.@"
|
||||
// TemplateLayoutContextKey is the name of the user values which can be used to set a template layout from a middleware and override the parent's
|
||||
TemplateLayoutContextKey = "templateLayout"
|
||||
)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package config
|
||||
|
||||
import "github.com/imdario/mergo"
|
||||
import (
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/iris-contrib/rest"
|
||||
)
|
||||
|
||||
// Default values for base Iris conf
|
||||
const (
|
||||
@@ -78,16 +81,19 @@ type (
|
||||
// http://debug.yourdomain:PORT/threadcreate
|
||||
// http://debug.yourdomain:PORT/pprof/block
|
||||
ProfilePath string
|
||||
|
||||
// Logger the configuration for the logger
|
||||
// Iris logs ONLY SEMANTIC errors and the banner if enabled
|
||||
Logger Logger
|
||||
// DisableTemplateEngines set to true to disable loading the default template engine (html/template) and disallow the use of iris.UseEngine
|
||||
// default is false
|
||||
DisableTemplateEngines bool
|
||||
// IsDevelopment iris will act like a developer, for example
|
||||
// If true then re-builds the templates on each request
|
||||
// default is false
|
||||
IsDevelopment bool
|
||||
|
||||
// Sessions contains the configs for sessions
|
||||
Sessions Sessions
|
||||
|
||||
// Render contains the configs for template and rest configuration
|
||||
Render Render
|
||||
// Rest contains the configs for rest render configuration
|
||||
Rest rest.Config
|
||||
|
||||
// Websocket contains the configs for Websocket's server integration
|
||||
Websocket *Websocket
|
||||
@@ -95,41 +101,21 @@ type (
|
||||
// Tester contains the configs for the test framework, so far we have only one because all test framework's configs are setted by the iris itself
|
||||
Tester Tester
|
||||
}
|
||||
|
||||
// Render struct keeps organise all configuration about rendering, templates and rest currently.
|
||||
Render struct {
|
||||
// Template the configs for template
|
||||
Template Template
|
||||
// Rest configs for rendering.
|
||||
//
|
||||
// these options inside this config don't have any relation with the TemplateEngine
|
||||
// from github.com/kataras/iris/rest
|
||||
Rest Rest
|
||||
}
|
||||
)
|
||||
|
||||
// DefaultRender returns default configuration for templates and rest rendering
|
||||
func DefaultRender() Render {
|
||||
return Render{
|
||||
// set the default template config both not nil and default Engine to Standar
|
||||
Template: DefaultTemplate(),
|
||||
// set the default configs for rest
|
||||
Rest: DefaultRest(),
|
||||
}
|
||||
}
|
||||
|
||||
// Default returns the default configuration for the Iris staton
|
||||
func Default() Iris {
|
||||
return Iris{
|
||||
DisablePathCorrection: DefaultDisablePathCorrection,
|
||||
DisablePathEscape: DefaultDisablePathEscape,
|
||||
DisableBanner: false,
|
||||
ProfilePath: "",
|
||||
Logger: DefaultLogger(),
|
||||
Sessions: DefaultSessions(),
|
||||
Render: DefaultRender(),
|
||||
Websocket: DefaultWebsocket(),
|
||||
Tester: DefaultTester(),
|
||||
DisablePathCorrection: DefaultDisablePathCorrection,
|
||||
DisablePathEscape: DefaultDisablePathEscape,
|
||||
DisableBanner: false,
|
||||
DisableTemplateEngines: false,
|
||||
IsDevelopment: false,
|
||||
ProfilePath: "",
|
||||
Sessions: DefaultSessions(),
|
||||
Rest: rest.DefaultConfig(),
|
||||
Websocket: DefaultWebsocket(),
|
||||
Tester: DefaultTester(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,18 +144,3 @@ func (c Iris) MergeSingle(cfg Iris) (config Iris) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/* maybe some day
|
||||
// FromFile returns the configuration for Iris station
|
||||
//
|
||||
// receives one parameter
|
||||
// pathIni(string) the file path of the configuration-ini style
|
||||
//
|
||||
// returns an error if something bad happens
|
||||
func FromFile(pathIni string) (c Iris, err error) {
|
||||
c = Iris{}
|
||||
err = ini.MapTo(&c, pathIni)
|
||||
|
||||
return
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -69,6 +69,7 @@ type Server struct {
|
||||
//
|
||||
// Default buffer size is used if not set.
|
||||
WriteBufferSize int
|
||||
|
||||
// RedirectTo, defaults to empty, set it in order to override the station's handler and redirect all requests to this address which is of form(HOST:PORT or :PORT)
|
||||
//
|
||||
// NOTE: the http status is 'StatusMovedPermanently', means one-time-redirect(the browser remembers the new addr and goes to the new address without need to request something from this server
|
||||
|
||||
Reference in New Issue
Block a user