@@ -10,17 +10,6 @@ import (
1010
1111// InitHotReload sets up hot-reloading for configuration files
1212func (proxy * Proxy ) InitHotReload () error {
13- // Check if hot reload is enabled
14- if ! proxy .enableHotReload {
15- dlog .Notice ("Hot reload is disabled" )
16- return nil
17- }
18-
19- dlog .Notice ("Hot reload is enabled" )
20-
21- // Create a new configuration watcher
22- configWatcher := NewConfigWatcher (1000 ) // Check every second
23-
2413 // Find plugins that support hot-reloading
2514 plugins := []Plugin {}
2615
@@ -40,6 +29,20 @@ func (proxy *Proxy) InitHotReload() error {
4029 }
4130 proxy .pluginsGlobals .RUnlock ()
4231
32+ // Setup SIGHUP handler for manual reload
33+ setupSignalHandler (proxy , plugins )
34+
35+ // Check if hot reload is enabled
36+ if ! proxy .enableHotReload {
37+ dlog .Notice ("Hot reload is disabled" )
38+ return nil
39+ }
40+
41+ dlog .Notice ("Hot reload is enabled" )
42+
43+ // Create a new configuration watcher
44+ configWatcher := NewConfigWatcher (1000 ) // Check every second
45+
4346 // Register plugins for config watching
4447 for _ , plugin := range plugins {
4548 switch p := plugin .(type ) {
@@ -100,9 +103,6 @@ func (proxy *Proxy) InitHotReload() error {
100103 }
101104 }
102105
103- // Setup SIGHUP handler for manual reload
104- setupSignalHandler (proxy , plugins )
105-
106106 return nil
107107}
108108
0 commit comments