configiface

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigurationBuilder

type ConfigurationBuilder interface {
	// Unmarshal loads configuration into the provided structure from environment variables.
	// Use the "env" tag on cfgStruct fields to indicate the corresponding environment variable to load from.
	Unmarshal(cfgStruct interface{}) error
	// Dump dumps the current config into the provided structure. Config keys are matched to
	// cfgStruct fields using the "env" tag.
	Dump(cfgStruct interface{}) error
	// WithService is a Builder Pattern method that allows you to specify services
	// for the given type.
	WithService(svc interface{}) *config.ConfigurationBuilder
	// WithEnv allows you to point to an environment variable for the value and
	// also specify a default using defaultValue
	WithEnv(key string, envVar string, defaultValue interface{}) *config.ConfigurationBuilder
	// WithParameterStoreEnv sets a config value from SSM Parameter store. The Parameter name is taken
	// from the provided environment variable. If the environment variable or SSM parameter can't be retrieved,
	// then the default value is used.
	// Requires that an SSM service of type ssmiface.SSMAPI is contained within config
	WithParameterStoreEnv(key string, envVar string, defaultValue string) *config.ConfigurationBuilder
	// WithVal allows you to hardcode string values into the configuration.
	// This is good for testing, injecting known values or values derived by means
	// outside the configuration.
	WithVal(key string, val interface{}) *config.ConfigurationBuilder
	// GetService retreives the service with the given type. An error is thrown if
	// the service is not found.
	GetService(svcFor interface{}) error
	// GetStringVal returns the value of the key as a string.
	GetStringVal(key string) (string, error)
	// GetVal returns the raw value
	GetVal(key string) (interface{}, error)
	// Build builds the configuration.
	Build() error
	// RetrieveParameterStoreVals - Get the values from the AWS Parameter Store
	RetrieveParameterStoreVals() error
}

ConfigurationBuilder makes working with the ConfigurationBuild easier

type ServiceBuilder

type ServiceBuilder interface {
	// WithSTS tells the builder to add an AWS STS service to the `DefaultConfigurater`
	WithSTS() *config.ServiceBuilder
	// WithSNS tells the builder to add an AWS SNS service to the `DefaultConfigurater`
	WithSNS() *config.ServiceBuilder
	// WithSQS tells the builder to add an AWS SQS service to the `DefaultConfigurater`
	WithSQS() *config.ServiceBuilder
	// WithDynamoDB tells the builder to add an AWS DynamoDB service to the `DefaultConfigurater`
	WithDynamoDB() *config.ServiceBuilder
	// WithS3 tells the builder to add an AWS S3 service to the `DefaultConfigurater`
	WithS3() *config.ServiceBuilder
	// WithCognito tells the builder to add an AWS Cognito service to the `DefaultConfigurater`
	WithCognito() *config.ServiceBuilder
	// WithCodeBuild tells the builder to add an AWS CodeBuild service to the `DefaultConfigurater`
	WithCodeBuild() *config.ServiceBuilder
	// WithSSM tells the builder to add an AWS SSM service to the `DefaultConfigurater`
	WithSSM() *config.ServiceBuilder
	// Build creates and returns a structue with AWS services
	Build() (*config.ConfigurationBuilder, error)
}

ServiceBuilder makes working with the ServiceBuild easier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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