MCPcopy Create free account
hub / github.com/kataras/iris / Configuration

Struct Configuration

configuration.go:637–979  ·  view source on GitHub ↗

Configuration holds the necessary settings for an Iris Application instance. All fields are optionally, the default values will work for a common web application. A Configuration value can be passed through `WithConfiguration` Configurator. Usage: conf := iris.Configuration{ ... } app := iris.New()

Source from the content-addressed store, hash-verified

635// app.Configure(iris.WithConfiguration(conf)) OR
636// app.Run/Listen(..., iris.WithConfiguration(conf)).
637type Configuration struct {
638 // VHost lets you customize the trusted domain this server should run on.
639 // Its value will be used as the return value of Context.Domain() too.
640 // It can be retrieved by the context if needed (i.e router for subdomains)
641 VHost string `ini:"v_host" json:"vHost" yaml:"VHost" toml:"VHost" env:"V_HOST"`
642
643 // LogLevel is the log level the application should use to output messages.
644 // Logger, by default, is mostly used on Build state but it is also possible
645 // that debug error messages could be thrown when the app is running, e.g.
646 // when malformed data structures try to be sent on Client (i.e Context.JSON/JSONP/XML...).
647 //
648 // Defaults to "info". Possible values are:
649 // * "disable"
650 // * "fatal"
651 // * "error"
652 // * "warn"
653 // * "info"
654 // * "debug"
655 LogLevel string `ini:"log_level" json:"logLevel" yaml:"LogLevel" toml:"LogLevel" env:"LOG_LEVEL"`
656
657 // SocketSharding enables SO_REUSEPORT (or SO_REUSEADDR for windows)
658 // on all registered Hosts.
659 // This option allows linear scaling server performance on multi-CPU servers.
660 //
661 // Please read the following:
662 // 1. https://stackoverflow.com/a/14388707
663 // 2. https://stackoverflow.com/a/59692868
664 // 3. https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1/
665 // 4. (BOOK) Learning HTTP/2: A Practical Guide for Beginners:
666 // Page 37, To Shard or Not to Shard?
667 //
668 // Defaults to false.
669 SocketSharding bool `ini:"socket_sharding" json:"socketSharding" yaml:"SocketSharding" toml:"SocketSharding" env:"SOCKET_SHARDING"`
670 // KeepAlive sets the TCP connection's keep-alive duration.
671 // If set to greater than zero then a tcp listener featured keep alive
672 // will be used instead of the simple tcp one.
673 //
674 // Defaults to 0.
675 KeepAlive time.Duration `ini:"keepalive" json:"keepAlive" yaml:"KeepAlive" toml:"KeepAlive" env:"KEEP_ALIVE"`
676 // Timeout wraps the application's router with an http timeout handler
677 // if the value is greater than zero.
678 //
679 // The underline response writer supports the Pusher interface but does not support
680 // the Hijacker or Flusher interfaces when Timeout handler is registered.
681 //
682 // Read more at: https://pkg.go.dev/net/http#TimeoutHandler.
683 Timeout time.Duration `ini:"timeout" json:"timeout" yaml:"Timeout" toml:"Timeout"`
684 // TimeoutMessage specifies the HTML body when a handler hits its life time based
685 // on the Timeout configuration field.
686 TimeoutMessage string `ini:"timeout_message" json:"timeoutMessage" yaml:"TimeoutMessage" toml:"TimeoutMessage"`
687 // NonBlocking, if set to true then the server will start listening for incoming connections
688 // without blocking the main goroutine. Use the Application.Wait method to block and wait for the server to be up and running.
689 NonBlocking bool `ini:"non_blocking" json:"nonBlocking" yaml:"NonBlocking" toml:"NonBlocking"`
690
691 // Tunneling can be optionally set to enable ngrok http(s) tunneling for this Iris app instance.
692 // See the `WithTunneling` Configurator too.
693 Tunneling TunnelingConfiguration `ini:"tunneling" json:"tunneling,omitempty" yaml:"Tunneling" toml:"Tunneling"`
694 // IgnoreServerErrors will cause to ignore the matched "errors"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected