environments

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Index

Constants

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

	EnvironmentStringKey string = "API_ENV"
	EnvironmentDefault          = DevelopmentEnv
)

Variables

This section is empty.

Functions

func GetEnvironmentStrFromEnv

func GetEnvironmentStrFromEnv() string

func SetConfigDefaults

func SetConfigDefaults(flags *pflag.FlagSet, defaults map[string]string) error

Types

type ApplicationConfig

type ApplicationConfig struct {
	ApplicationConfig *config.ApplicationConfig
}

type Clients

type Clients struct {
	APIClient *apiclient.Client
}

type ConfigDefaults

type ConfigDefaults struct {
	Server    map[string]interface{}
	Metrics   map[string]interface{}
	Database  map[string]interface{}
	APIClient 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
	Config   *config.ApplicationConfig
}

func Environment

func Environment() *Env

func NewEnvironment

func NewEnvironment(impls map[string]EnvironmentImpl) *Env

func (*Env) AddFlags

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

func (*Env) Initialize

func (e *Env) Initialize() error

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

func (e *Env) SetEnvironmentImpls(impls map[string]EnvironmentImpl)

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
}

type Handlers

type Handlers struct {
	AuthMiddleware JWTMiddleware
}

type JWTMiddleware added in v0.0.17

type JWTMiddleware interface {
	AuthenticateAccountJWT(next http.Handler) http.Handler
}

JWTMiddleware interface for JWT authentication - avoiding import cycle

type Services

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

func (*Services) GetService

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

func (*Services) InitRegistry

func (s *Services) InitRegistry()

func (*Services) SetService

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

Jump to

Keyboard shortcuts

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