environments

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnitTestingEnv        string = "unit_testing"
	IntegrationTestingEnv string = "integration_testing"
	DevelopmentEnv        string = "development"
	ProductionEnv         string = "production"

	EnvironmentStringKey string = "OCM_ENV"
	EnvironmentDefault          = DevelopmentEnv
)

Variables

This section is empty.

Functions

func GetEnvironmentStrFromEnv

func GetEnvironmentStrFromEnv() string

Types

type ApplicationConfig

type ApplicationConfig struct {
	ApplicationConfig *config.ApplicationConfig
}

type Clients

type Clients struct {
	OCM *ocm.Client
}

type ConfigDefaults

type ConfigDefaults struct {
	Server   map[string]interface{}
	Metrics  map[string]interface{}
	Database map[string]interface{}
	OCM      map[string]interface{}
	Options  map[string]interface{}
}

type Database

type Database struct {
	SessionFactory db.SessionFactory
}

type Env

type Env struct {
	Name     string
	Services Services
	Handlers Handlers
	Clients  Clients
	Database Database
	// most code relies on env.Config
	Config *config.ApplicationConfig
}

func Environment

func Environment() *Env

func (*Env) AddFlags

func (e *Env) AddFlags(flags *pflag.FlagSet) error

AddFlags Adds environment flags, using the environment's config struct, to the flagset 'flags'

func (*Env) Initialize

func (e *Env) Initialize() error

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) LoadClients

func (e *Env) LoadClients() error

func (*Env) LoadServices

func (e *Env) LoadServices()

func (*Env) Seed

func (e *Env) Seed() *errors.ServiceError

func (*Env) Teardown

func (e *Env) Teardown()

type EnvironmentImpl

type EnvironmentImpl interface {
	Flags() map[string]string
	OverrideConfig(c *config.ApplicationConfig) error
	OverrideServices(s *Services) error
	OverrideDatabase(s *Database) error
	OverrideHandlers(c *Handlers) error
	OverrideClients(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 and configuration functions for each component type.

type Handlers

type Handlers struct {
	AuthMiddleware auth.JWTMiddleware
}

type Services

type Services struct {
	// contains filtered or unexported fields
}

func (*Services) GetService

func (s *Services) GetService(name string) interface{}

func (*Services) SetService

func (s *Services) SetService(name string, service interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL