appconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package appconfig retrieves configuration through the AppConfig Data API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppConfig

func GetAppConfig(ctx context.Context, name string, options DefaultOptions) (any, error)

GetAppConfig uses the application and environment from the first successful initialization. Use separate providers for different applications or environments.

Types

type Client

type Client interface {
	StartConfigurationSession(context.Context, *sdk.StartConfigurationSessionInput, ...func(*sdk.Options)) (*sdk.StartConfigurationSessionOutput, error)
	GetLatestConfiguration(context.Context, *sdk.GetLatestConfigurationInput, ...func(*sdk.Options)) (*sdk.GetLatestConfigurationOutput, error)
}

type Config

type Config struct {
	Application, Environment string
	// Clock defaults to time.Now and controls both cache and token expiry.
	Clock func() time.Time
}

type DefaultOptions

type DefaultOptions struct {
	GetOptions
	Application, Environment string
}

type GetOptions

type GetOptions struct {
	parameters.Options
	SDKOptions *sdk.StartConfigurationSessionInput
}

type Provider

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

func New

func New(client Client, config Config) (*Provider, error)

func (*Provider) ClearCache

func (p *Provider) ClearCache()

ClearCache clears transformed values. Session tokens and last known configuration remain available because an unchanged AppConfig response has an empty body.

func (*Provider) Get

func (p *Provider) Get(ctx context.Context, name string, options GetOptions) (any, error)

Jump to

Keyboard shortcuts

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