Documentation ¶
Index ¶
- Constants
- func GetEnvironmentStrFromEnv() string
- type ApplicationConfig
- type ClientVisitable
- type ClientVisitor
- type Clients
- type ConfigDefaults
- type ConfigVisitable
- type ConfigVisitor
- type Database
- type DatabaseVisitable
- type DatabaseVisitor
- type DinosaurServiceLocator
- type Env
- type EnvironmentImpl
- type EventServiceLocator
- type GenericServiceLocator
- type HandlerVisitable
- type HandlerVisitor
- type Handlers
- type ServiceVisitable
- type ServiceVisitor
- type Services
Constants ¶
const ( TestingEnv string = "testing" DevelopmentEnv string = "development" ProductionEnv string = "production" EnvironmentStringKey string = "OCM_ENV" EnvironmentDefault string = DevelopmentEnv )
Variables ¶
This section is empty.
Functions ¶
func GetEnvironmentStrFromEnv ¶
func GetEnvironmentStrFromEnv() string
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct {
ApplicationConfig *config.ApplicationConfig
}
func (*ApplicationConfig) Accept ¶
func (c *ApplicationConfig) Accept(v ConfigVisitor) error
type ClientVisitable ¶
type ClientVisitable interface {
Accept(v ClientVisitor) error
}
type ClientVisitor ¶
type ConfigDefaults ¶
type ConfigVisitable ¶
type ConfigVisitable interface {
Accept(v ConfigVisitor) error
}
type ConfigVisitor ¶
type ConfigVisitor interface {
VisitConfig(c *ApplicationConfig) error
}
type Database ¶
type Database struct {
SessionFactory db.SessionFactory
}
func (*Database) Accept ¶
func (d *Database) Accept(v DatabaseVisitor) error
type DatabaseVisitable ¶
type DatabaseVisitable interface {
Accept(v DatabaseVisitor) error
}
type DatabaseVisitor ¶
type DinosaurServiceLocator ¶
type DinosaurServiceLocator func() services.DinosaurService
func NewDinosaurServiceLocator ¶
func NewDinosaurServiceLocator(env *Env) DinosaurServiceLocator
type Env ¶
type Env struct { Name string Services Services Handlers Handlers Clients Clients Database Database // packaging requires this construct for visiting ApplicationConfig ApplicationConfig // most code relies on env.Config Config *config.ApplicationConfig }
func Environment ¶
func Environment() *Env
func (*Env) AddFlags ¶
Adds environment flags, using the environment's config struct, to the flagset 'flags'
func (*Env) Initialize ¶
Initialize loads the environment's resources This should be called after the e.Config has been set appropriately though AddFlags and pasing, done elsewhere The environment does NOT handle flag parsing
func (*Env) InitializeSentry ¶
func (*Env) LoadClients ¶
func (*Env) LoadServices ¶
func (e *Env) LoadServices()
func (*Env) Seed ¶
func (e *Env) Seed() *errors.ServiceError
type EnvironmentImpl ¶
type EnvironmentImpl interface { Flags() map[string]string VisitConfig(c *ApplicationConfig) error VisitDatabase(s *Database) error VisitServices(s *Services) error VisitHandlers(c *Handlers) error VisitClients(c *Clients) error }
EnvironmentImpl defines a set of behaviors for an OCM environment. Each environment provides a set of flags for basic set/override of the environment. Each environment is a set of configured things (services, handlers, clients, etc.) and we may expect a stable set of components. Use Visitor pattern to allow external callers (an environment) to affect the internal structure of components. Each visitor is applied after a component is instantiated with flags set. VisitorConfig is applies after instantiation but before ReadFiles is called.
type EventServiceLocator ¶
type EventServiceLocator func() services.EventService
func NewEventServiceLocator ¶
func NewEventServiceLocator(env *Env) EventServiceLocator
type GenericServiceLocator ¶
type GenericServiceLocator func() services.GenericService
func NewGenericServiceLocator ¶
func NewGenericServiceLocator(env *Env) GenericServiceLocator
type HandlerVisitable ¶
type HandlerVisitable interface {
Accept(v HandlerVisitor) error
}
type HandlerVisitor ¶
type Handlers ¶
type Handlers struct {
AuthMiddleware auth.JWTMiddleware
}
func (*Handlers) Accept ¶
func (c *Handlers) Accept(v HandlerVisitor) error
type ServiceVisitable ¶
type ServiceVisitable interface {
Accept(v ServiceVisitor) error
}
type ServiceVisitor ¶
type Services ¶
type Services struct { Dinosaurs DinosaurServiceLocator Generic GenericServiceLocator Events EventServiceLocator }
func (*Services) Accept ¶
func (s *Services) Accept(v ServiceVisitor) error