feat(gateway): add debug logging with file storage and retention feat(gateway): add audit logging for user actions feat(gateway): add request ID tracking and rate limit headers feat(gateway): add model aliases and load balancing strategies feat(gateway): add config hot-reload via SIGHUP feat(gateway): add CORS support feat(gateway): add data export API and dashboard endpoints feat(gateway): add dashboard pages for audit and debug logs feat(gateway): add concurrent request limiting per token feat(gateway): add streaming timeout support feat(gateway): add migration support for new schema fields
27 lines
574 B
Go
27 lines
574 B
Go
package config
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
// WatchReload listens for SIGHUP and calls the callback with the new config.
|
|
func WatchReload(configPath string, callback func(*Config)) {
|
|
sighup := make(chan os.Signal, 1)
|
|
signal.Notify(sighup, syscall.SIGHUP)
|
|
|
|
go func() {
|
|
for range sighup {
|
|
log.Println("SIGHUP received, reloading config...")
|
|
newCfg, err := Load(configPath)
|
|
if err != nil {
|
|
log.Printf("ERROR: config reload failed: %v", err)
|
|
continue
|
|
}
|
|
callback(newCfg)
|
|
log.Println("Config reloaded successfully")
|
|
}
|
|
}()
|
|
}
|