gappconfig

package module
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 6 Imported by: 3

README

gapp-config

Documentation

Index

Constants

View Source
const (
	// ContainerID defines the id to be used as the container
	// registration id of a config instance, as a base id of all other config
	// package instances registered in the application container.
	ContainerID = gapp.ContainerID + ".config"

	// ContainerDecoderStrategyTag defines the tag to be assigned to all
	// container decoders strategies.
	ContainerDecoderStrategyTag = ContainerID + ".decoder.strategy"

	// ContainerDecoderStrategyYAMLID defines the id to be used as the
	// container registration id of a yaml config decoder factory strategy
	// instance.
	ContainerDecoderStrategyYAMLID = ContainerID + ".decoder.strategy.yaml"

	// ContainerDecoderStrategyJSONID defines the id to be used as the
	// container registration id of a json config decoder factory strategy
	// instance.
	ContainerDecoderStrategyJSONID = ContainerID + ".decoder.strategy.json"

	// ContainerDecoderFactoryID defines the id to be used as the
	// container registration id of a config decoder factory instance.
	ContainerDecoderFactoryID = ContainerID + ".decoder.factory"

	// ContainerSourceStrategyTag defines the tag to be assigned to all
	// container source strategies.
	ContainerSourceStrategyTag = ContainerID + ".source.strategy"

	// ContainerSourceStrategyFileID defines the id to be used as the
	// container registration id of a config file source factory strategy
	// instance.
	ContainerSourceStrategyFileID = ContainerID + ".source.strategy.file"

	// ContainerSourceStrategyFileObservableID defines the id to be used
	// as the container registration id of a config observable file source
	// factory strategy instance.
	ContainerSourceStrategyFileObservableID = ContainerID + ".source.strategy.file_observable"

	// ContainerSourceStrategyDirID defines the id to be used as the
	// container registration id of a config dir source factory strategy
	// instance.
	ContainerSourceStrategyDirID = ContainerID + ".source.strategy.dir"

	// ContainerSourceStrategyRemoteID defines the id to be used as the
	// container registration id of a config remote source factory strategy
	// instance.
	ContainerSourceStrategyRemoteID = ContainerID + ".source.strategy.remote"

	// ContainerSourceStrategyRemoteObservableID defines the id to be used
	// as the container registration id of a config observable remote source
	// factory strategy instance.
	ContainerSourceStrategyRemoteObservableID = ContainerID + ".source.strategy.remote_observable"

	// ContainerSourceStrategyEnvID defines the id to be used as
	// the container registration id of a config environment source
	// factory strategy instance.
	ContainerSourceStrategyEnvID = ContainerID + ".source.strategy.env"

	// ContainerSourceFactoryID defines the id to be used as the
	// container registration id config source factory instance.
	ContainerSourceFactoryID = ContainerID + ".source.factory"

	// ContainerLoaderID defines the id to be used as the container
	// registration id of a config loader instance.
	ContainerLoaderID = ContainerID + ".loader"
)

Variables

View Source
var (
	// ErrNilPointer defines a nil pointer argument error
	ErrNilPointer = gapp.ErrNilPointer

	// ErrConversion defines a type conversion error
	ErrConversion = gapp.ErrConversion
)
View Source
var (
	// ObserveFrequency defines the id to be used as the default of a
	// config observable source frequency time in seconds.
	ObserveFrequency = genv.Int("GAPP_CONFIG_OBSERVE_FREQUENCY", 0)

	// LoaderActive defines if the config loader should be executed
	// while the provider boot
	LoaderActive = genv.Bool("GAPP_CONFIG_LOADER_ACTIVE", true)
)

Functions

func GetConfig added in v1.7.0

func GetConfig(c gapp.ServiceContainer) (gconfig.Manager, error)

GetConfig will try to retrieve the registered config instance from the application service container.

func GetDecoderFactory added in v1.7.0

func GetDecoderFactory(c gapp.ServiceContainer) (*gconfig.DecoderFactory, error)

GetDecoderFactory will try to retrieve the registered decoder factory instance from the application service container.

func GetDecoderStrategies added in v1.7.0

func GetDecoderStrategies(c gapp.ServiceContainer) ([]gconfig.DecoderStrategy, error)

GetDecoderStrategies will try to retrieve the registered the list of decoder strategies instances from the application service container.

func GetLoader added in v1.7.0

func GetLoader(c gapp.ServiceContainer) (*gconfig.Loader, error)

GetLoader will try to retrieve the registered loader instance from the application service container.

func GetSourceFactory added in v1.7.0

func GetSourceFactory(c gapp.ServiceContainer) (*gconfig.SourceFactory, error)

GetSourceFactory will try to retrieve the registered source factory instance from the application service container.

func GetSourceStrategies added in v1.7.0

func GetSourceStrategies(c gapp.ServiceContainer) ([]gconfig.SourceStrategy, error)

GetSourceStrategies will try to retrieve the registered the list of source strategies instances from the application service container.

Types

type Provider added in v1.6.0

type Provider struct{}

Provider defines the gapp/config module service provider to be used on the application initialization to register the config service.

func (Provider) Boot added in v1.6.0

func (p Provider) Boot(c gapp.ServiceContainer) error

Boot will start the configuration config instance by calling the configuration loader with the defined provider base entry information.

func (Provider) Register added in v1.6.0

func (p Provider) Register(c gapp.ServiceContainer) error

Register will register the configuration section instances in the application container.

Jump to

Keyboard shortcuts

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