env

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlobalEnvs

type GlobalEnvs struct {
	DeploymentEnv     definition.ServiceDeploy `env:"MIKROS_SERVICE_DEPLOY,default_value=local"`
	TrackerHeaderName string                   `env:"MIKROS_TRACKER_HEADER_NAME,default_value=X-Request-ID"`

	// CI/CD settings
	IsCICD bool `env:"MIKROS_CICD_TEST,default_value=false"`

	// Coupled clients
	CoupledNamespace string `env:"MIKROS_COUPLED_NAMESPACE"`
	CoupledPort      int32  `env:"MIKROS_COUPLED_PORT,default_value=7070"`

	// Default connection ports
	GrpcPort int32 `env:"MIKROS_GRPC_PORT,default_value=7070"`
	HttpPort int32 `env:"MIKROS_HTTP_PORT,default_value=8080"`
}

GlobalEnvs is the main framework structure that holds environment variables. Main variables are declared as structure member and are loaded directly, using struct tags.

type ServiceEnvs

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

ServiceEnvs is the object that will allow all internal (and external) mikros features to access the environment variables loaded.

func NewServiceEnvs

func NewServiceEnvs(defs *definition.Definitions) (*ServiceEnvs, error)

NewServiceEnvs loads the framework main environment variables through the env feature plugin.

func (*ServiceEnvs) CoupledNamespace

func (s *ServiceEnvs) CoupledNamespace() string

func (*ServiceEnvs) CoupledPort

func (s *ServiceEnvs) CoupledPort() int32

func (*ServiceEnvs) DefinedEnv

func (s *ServiceEnvs) DefinedEnv(name string) (string, bool)

func (*ServiceEnvs) DeploymentEnv

func (s *ServiceEnvs) DeploymentEnv() definition.ServiceDeploy

func (*ServiceEnvs) Get

func (s *ServiceEnvs) Get(key string) string

func (*ServiceEnvs) GetBool

func (s *ServiceEnvs) GetBool(name string) (bool, error)

func (*ServiceEnvs) GetInt

func (s *ServiceEnvs) GetInt(name string) (int, error)

func (*ServiceEnvs) GrpcPort

func (s *ServiceEnvs) GrpcPort() int32

func (*ServiceEnvs) HttpPort

func (s *ServiceEnvs) HttpPort() int32

func (*ServiceEnvs) IsCICD

func (s *ServiceEnvs) IsCICD() bool

func (*ServiceEnvs) TrackerHeaderName

func (s *ServiceEnvs) TrackerHeaderName() string

Jump to

Keyboard shortcuts

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