Documentation ¶
Overview ¶
The environment package provides a way to setup a global environment and also have the ability to create local encironments for testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Env = New()
Global Environment, use it if you want to or create your own with New()
Functions ¶
func RegisterService ¶
Types ¶
type Environment ¶
type Environment struct { *viper.Viper casa.MessageBus *ServiceRegistry SignalHandler BrokerLogger broker.Logger casa.Logger }
func New ¶
func New(options ...Option) *Environment
func (*Environment) WithOptions ¶
func (e *Environment) WithOptions(options ...Option) *Environment
type NullMessageBus ¶
type NullMessageBus struct{}
func (NullMessageBus) Close ¶
func (b NullMessageBus) Close() error
func (NullMessageBus) NewClient ¶
func (b NullMessageBus) NewClient() casa.MessageClient
type NullMessageStore ¶
type NullMessageStore struct{}
func (NullMessageStore) Close ¶
func (s NullMessageStore) Close() error
func (NullMessageStore) Store ¶
func (s NullMessageStore) Store(topic string, bus casa.MessageBus) error
type Option ¶
type Option func(*Environment)
func WithBrokerLogger ¶
func WithBus ¶
func WithBus(bus casa.MessageBus) Option
func WithHandler ¶
func WithHandler(handler SignalHandler) Option
func WithLogger ¶
func WithRegistry ¶
func WithRegistry(svc *ServiceRegistry) Option
type ServiceRegistry ¶
func (*ServiceRegistry) AddService ¶
func (s *ServiceRegistry) AddService(name string, service casa.Service)
func (*ServiceRegistry) GetAllServices ¶
func (s *ServiceRegistry) GetAllServices() map[string]casa.Service
func (*ServiceRegistry) GetService ¶
func (s *ServiceRegistry) GetService(name string) casa.Service
func (*ServiceRegistry) RemoveService ¶
func (s *ServiceRegistry) RemoveService(name string)
type SignalHandler ¶
Click to show internal directories.
Click to hide internal directories.