From ff5b4639d597203f8aec43e5eae8fe3774976d32 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 16 May 2019 11:46:17 -0600 Subject: Some minor updates, and get rid of OnLoad/OnUnload --- caddy.go | 54 +----------------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) (limited to 'caddy.go') diff --git a/caddy.go b/caddy.go index 2aa0c6a..585b9df 100644 --- a/caddy.go +++ b/caddy.go @@ -100,33 +100,6 @@ func Run(cfg *Config) error { } }() - // OnLoad - err = func() error { - for modName, instances := range moduleInstances { - mod, err := GetModule(modName) - if err != nil { - return err - } - if mod.OnLoad != nil { - var priorState interface{} - if oldCfg != nil { - priorState = oldCfg.moduleStates[modName] - } - modState, err := mod.OnLoad(instances, priorState) - if err != nil { - return fmt.Errorf("module OnLoad: %s: %v", modName, err) - } - if modState != nil { - cfg.moduleStates[modName] = modState - } - } - } - return nil - }() - if err != nil { - return err - } - // Start err = func() error { h := Handle{cfg} @@ -158,31 +131,6 @@ func Run(cfg *Config) error { } } - // OnUnload - err = func() error { - for modName := range oldModuleInstances { - mod, err := GetModule(modName) - if err != nil { - return err - } - if mod.OnUnload != nil { - var unloadingState interface{} - if oldCfg != nil { - unloadingState = oldCfg.moduleStates[modName] - } - err := mod.OnUnload(unloadingState) - if err != nil { - log.Printf("[ERROR] module OnUnload: %s: %v", modName, err) - continue - } - } - } - return nil - }() - if err != nil { - return err - } - // shut down listeners that are no longer being used err = func() error { listenersMu.Lock() @@ -240,7 +188,7 @@ type Handle struct { // App returns the configured app named name. If no app with // that name is currently configured, a new empty one will be -// instantiated. (The app module must still be plugged in.) +// instantiated. (The app module must still be registered.) func (h Handle) App(name string) (interface{}, error) { if app, ok := h.current.apps[name]; ok { return app, nil -- cgit v1.2.3