provider

package
v1.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(source string) (map[string]string, error)

Load loads a configuration source and returns its content as a flattened Storage.

func LoadFile

func LoadFile(optional bool, source string) (map[string]string, error)

LoadFile loads a configuration file and returns its content as a flattened Storage. If the file does not exist and optional is true, it returns nil without error.

func Register

func Register(name string, p Provider)

Register registers a Provider for a specific configuration source type.

Types

type Provider

type Provider func(optional bool, source string) (map[string]string, error)

Provider defines a function type that provides configuration data from a specific source.

If access to a remote server is needed, the information required to access it is usually placed in the source string or passed through environment variables.

To support dynamic refresh, a version number field can be added and a regular Bean can be registered to listen for changes. When the version changes, the configuration can be updated.

Jump to

Keyboard shortcuts

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