mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00:00
able to share static configuration between multiple server instances based on the homepath+iris.yml file with iris.WithGlobalConfiguration configurator
Former-commit-id: 3e528a3d01eb36b4c0781149e52acffd4dc5cf9f
This commit is contained in:
@@ -53,6 +53,7 @@ Structuring depends on your own needs. We can't tell you how to design your own
|
||||
- [Functional](configuration/functional/main.go)
|
||||
- [From Configuration Struct](configuration/from-configuration-structure/main.go)
|
||||
- [Import from YAML file](configuration/from-yaml-file/main.go)
|
||||
* [Share Configuration between multiple instances](configuration/from-yaml-file/shared-configuration/main.go)
|
||||
- [Import from TOML file](configuration/from-toml-file/main.go)
|
||||
|
||||
### Routing, Grouping, Dynamic Path Parameters, "Macros" and Custom Context
|
||||
|
||||
@@ -12,6 +12,8 @@ func main() {
|
||||
// [...]
|
||||
|
||||
// Good when you have two configurations, one for development and a different one for production use.
|
||||
// If iris.YAML's input string argument is "~" then it loads the configuration from the home directory
|
||||
// and can be shared between many iris instances.
|
||||
app.Run(iris.Addr(":8080"), iris.WithConfiguration(iris.YAML("./configs/iris.yml")))
|
||||
|
||||
// or before run:
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.HTML("<b>Hello!</b>")
|
||||
})
|
||||
// [...]
|
||||
|
||||
// Good when you share configuration between multiple iris instances.
|
||||
// This configuration file lives in your $HOME/iris.yml for unix hosts
|
||||
// or %HOMEDRIVE%+%HOMEPATH%/iris.yml for windows hosts, and you can modify it.
|
||||
app.Run(iris.Addr(":8080"), iris.WithGlobalConfiguration)
|
||||
// or before run:
|
||||
// app.Configure(iris.WithGlobalConfiguration)
|
||||
// app.Run(iris.Addr(":8080"))
|
||||
}
|
||||
Reference in New Issue
Block a user