MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / startAdapterServer

Function startAdapterServer

cmd/cql/internal/adapter.go:56–78  ·  view source on GitHub ↗
(adapterAddr string, adapterUseMirrorAddr string)

Source from the content-addressed store, hash-verified

54}
55
56func startAdapterServer(adapterAddr string, adapterUseMirrorAddr string) func() {
57 adapterHTTPServer, err := adapter.NewHTTPAdapter(adapterAddr, configFile, adapterUseMirrorAddr)
58 if err != nil {
59 ConsoleLog.WithError(err).Error("init adapter failed")
60 SetExitStatus(1)
61 return nil
62 }
63
64 if err = adapterHTTPServer.Serve(); err != nil {
65 ConsoleLog.WithError(err).Error("start adapter failed")
66 SetExitStatus(1)
67 return nil
68 }
69
70 ConsoleLog.Infof("adapter started on %s", adapterAddr)
71
72 return func() {
73 ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
74 defer cancel()
75 adapterHTTPServer.Shutdown(ctx)
76 ConsoleLog.Info("adapter stopped")
77 }
78}
79
80func runAdapter(cmd *Command, args []string) {
81 commonFlagsInit(cmd)

Callers 2

runConsoleFunction · 0.85
runAdapterFunction · 0.85

Calls 8

ServeMethod · 0.95
ShutdownMethod · 0.95
NewHTTPAdapterFunction · 0.92
SetExitStatusFunction · 0.85
ErrorMethod · 0.80
WithErrorMethod · 0.80
InfofMethod · 0.80
InfoMethod · 0.80

Tested by

no test coverage detected