func Run(paths *ViewPath, address, baseURL string, recoverPanic bool) { Config.BaseURL = baseURL paths.initAndRegisterViewsRecursive("/") staticDirs := utils.CombineDirs(Config.BaseDirs, Config.StaticDirs) web.Config.StaticDirs = staticDirs web.Config.RecoverPanic = recoverPanic web.Config.CookieSecret = Config.CookieSecret web.Run(address) }
func initWebAndPaths(paths *ViewPath) { if !Config.initialized { err := Config.Init() if err != nil { panic(err) } } config.Logger.Print("view.Config.IsProductionServer = ", Config.IsProductionServer) config.Logger.Print("view.Config.Debug.Mode = ", Config.Debug.Mode) if paths != nil { paths.initAndRegisterViewsRecursive("/") } web.Config.StaticDirs = utils.CombineDirs(Config.BaseDirs, Config.StaticDirs) web.Config.RecoverPanic = Config.Debug.Mode web.Config.CookieSecret = Config.CookieSecret }
// RunServerAddr starts a webserver with the given paths and address. // If paths is nil, only static files will be served. func RunServerAddr(addr string, paths *ViewPath) { if !Config.initialized { err := Config.Init() if err != nil { panic(err) } } log.Print("view.Config.IsProductionServer = ", Config.IsProductionServer) log.Print("view.Config.Debug.Mode = ", Config.Debug.Mode) if paths != nil { paths.initAndRegisterViewsRecursive("/") } web.Config.StaticDirs = utils.CombineDirs(Config.BaseDirs, Config.StaticDirs) web.Config.RecoverPanic = Config.Debug.Mode web.Config.CookieSecret = Config.CookieSecret web.Run(addr) }