WithConfiguration sets the "c" values to the framework's configurations. Usage: app.Listen(":8080", iris.WithConfiguration(iris.Configuration{/* fields here */ })) or iris.WithConfiguration(iris.YAML("./cfg/iris.yml")) or iris.WithConfiguration(iris.TOML("./cfg/iris.tml"))
(c Configuration)
| 1195 | // or |
| 1196 | // iris.WithConfiguration(iris.TOML("./cfg/iris.tml")) |
| 1197 | func WithConfiguration(c Configuration) Configurator { |
| 1198 | return func(app *Application) { |
| 1199 | main := app.config |
| 1200 | |
| 1201 | if main == nil { |
| 1202 | app.config = &c |
| 1203 | return |
| 1204 | } |
| 1205 | |
| 1206 | if v := c.LogLevel; v != "" { |
| 1207 | main.LogLevel = v |
| 1208 | } |
| 1209 | |
| 1210 | if v := c.SocketSharding; v { |
| 1211 | main.SocketSharding = v |
| 1212 | } |
| 1213 | |
| 1214 | if v := c.KeepAlive; v > 0 { |
| 1215 | main.KeepAlive = v |
| 1216 | } |
| 1217 | |
| 1218 | if v := c.Timeout; v > 0 { |
| 1219 | main.Timeout = v |
| 1220 | } |
| 1221 | |
| 1222 | if v := c.TimeoutMessage; v != "" { |
| 1223 | main.TimeoutMessage = v |
| 1224 | } |
| 1225 | |
| 1226 | if v := c.NonBlocking; v { |
| 1227 | main.NonBlocking = v |
| 1228 | } |
| 1229 | |
| 1230 | if len(c.Tunneling.Tunnels) > 0 { |
| 1231 | main.Tunneling = c.Tunneling |
| 1232 | } |
| 1233 | |
| 1234 | if v := c.IgnoreServerErrors; len(v) > 0 { |
| 1235 | main.IgnoreServerErrors = append(main.IgnoreServerErrors, v...) |
| 1236 | } |
| 1237 | |
| 1238 | if v := c.DisableStartupLog; v { |
| 1239 | main.DisableStartupLog = v |
| 1240 | } |
| 1241 | |
| 1242 | if v := c.DisableInterruptHandler; v { |
| 1243 | main.DisableInterruptHandler = v |
| 1244 | } |
| 1245 | |
| 1246 | if v := c.DisablePathCorrection; v { |
| 1247 | main.DisablePathCorrection = v |
| 1248 | } |
| 1249 | |
| 1250 | if v := c.DisablePathCorrectionRedirection; v { |
| 1251 | main.DisablePathCorrectionRedirection = v |
| 1252 | } |
| 1253 | |
| 1254 | if v := c.EnablePathIntelligence; v { |
no outgoing calls
searching dependent graphs…