diff --git a/internal/sbi/server.go b/internal/sbi/server.go index 21cf2f1..88c67d3 100644 --- a/internal/sbi/server.go +++ b/internal/sbi/server.go @@ -19,18 +19,24 @@ import ( logger_util "github.com/free5gc/util/logger" ) -type Server struct { +type nssfApp interface { app.NssfApp + Processor() *processor.Processor +} + +type Server struct { + nssfApp + httpServer *http.Server router *gin.Engine processor *processor.Processor } -func NewServer(nssf app.NssfApp, tlsKeyLogPath string) *Server { +func NewServer(nssf nssfApp, tlsKeyLogPath string) *Server { s := &Server{ - NssfApp: nssf, - processor: processor.NewProcessor(nssf), + nssfApp: nssf, + processor: nssf.Processor(), } s.router = newRouter(s) diff --git a/pkg/service/init.go b/pkg/service/init.go index 724da34..7a298d4 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -45,6 +45,9 @@ func NewApp(cfg *factory.Config, tlsKeyLogPath string) (*NssfApp, error) { nssf.SetLogLevel(cfg.GetLogLevel()) nssf.SetReportCaller(cfg.GetLogReportCaller()) + processor := processor.NewProcessor(nssf) + nssf.processor = processor + consumer := consumer.NewConsumer(nssf) nssf.consumer = consumer