// Package archiemessaging composes the Messaging Service: chat channel // connections that send turns to the Gateway over gRPC. package archiemessaging import ( "errors" "time" ) // Process defaults. const ( defaultGatewayTarget = "127.0.0.1:8585" defaultListen = "127.0.0.1:8586" defaultDependencyTimeout = 5 * time.Second defaultShutdownTimeout = 5 * time.Second ) // ServiceTarget is one remote contract's endpoint. type ServiceTarget struct { Target string } // Options contains the process inputs for the Messaging Service. type Options struct { Config string Overlay string Gateway ServiceTarget StateStore ServiceTarget // Listen is where MessagingService is served. Listen string DependencyTimeout time.Duration ShutdownTimeout time.Duration } func withDefaults(o Options) Options { if o.Gateway.Target == "" { o.Gateway.Target = defaultGatewayTarget } if o.Listen == "" { o.Listen = defaultListen } if o.DependencyTimeout <= 0 { o.DependencyTimeout = defaultDependencyTimeout } if o.ShutdownTimeout <= 0 { o.ShutdownTimeout = defaultShutdownTimeout } return o } func (o Options) validate() error { if o.Gateway.Target == "" { return errors.New("gateway target is required (pass -gateway-target or configure [services.gateway].target)") } return nil }