MCPcopy Index your code
hub / github.com/FunctionStream/function-stream / WithConfig

Function WithConfig

server/server.go:211–239  ·  view source on GitHub ↗
(config *Config)

Source from the content-addressed store, hash-verified

209}
210
211func WithConfig(config *Config) ServerOption {
212 return serverOptionFunc(func(o *serverOptions) (*serverOptions, error) {
213 ln, err := net.Listen("tcp", config.ListenAddr)
214 if err != nil {
215 return nil, err
216 }
217 o.httpListener = ln
218 o.enableTls = config.EnableTLS
219 if o.enableTls {
220 if config.TLSCertFile == "" || config.TLSKeyFile == "" {
221 return nil, fmt.Errorf("TLS certificate and key file must be provided")
222 }
223 o.tlsCertFile = config.TLSCertFile
224 o.tlsKeyFile = config.TLSKeyFile
225 }
226 o.tubeConfig = config.TubeConfig
227 o.queueConfig = config.Queue
228 o.runtimeConfig = config.RuntimeConfig
229 if config.StateStore != nil {
230 stateStore, err := o.stateStoreLoader(config.StateStore)
231 if err != nil {
232 return nil, err
233 }
234 o.managerOpts = append(o.managerOpts, fs.WithStateStore(stateStore))
235 }
236 o.functionStore = config.FunctionStore
237 return o, nil
238 })
239}
240
241func NewServer(opts ...ServerOption) (*Server, error) {
242 options := &serverOptions{}

Callers 2

execFunction · 0.92
NewDefaultServerFunction · 0.85

Calls 2

WithStateStoreFunction · 0.92
serverOptionFuncFuncType · 0.85

Tested by

no test coverage detected