summaryrefslogtreecommitdiff
path: root/caddy.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-05-16 11:46:17 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-05-16 11:46:17 -0600
commitff5b4639d597203f8aec43e5eae8fe3774976d32 (patch)
treefa7f9d24494f61232c87efd6b68ee7f8909ffb00 /caddy.go
parentf9d93ead4ef6e099ba7e00318dce6509b0f1eda4 (diff)
Some minor updates, and get rid of OnLoad/OnUnload
Diffstat (limited to 'caddy.go')
-rw-r--r--caddy.go54
1 files changed, 1 insertions, 53 deletions
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