golconfig

package
v0.0.0-...-1bfd785 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfiguratorList = make(map[string]Configurator)

ConfiguratorList contains reference to all config adapters to be fetched for usage.

Functions

func RegisterConfigurator

func RegisterConfigurator(name string, configType Configurator)

RegisterConfigurator enables new (de)-serializing adapters to plug-in their reference.

Types

type ConfigJSON

type ConfigJSON struct{}

ConfigJSON send "json" to GetConfig to get it.

func (ConfigJSON) ConfigFromFile

func (configJSON ConfigJSON) ConfigFromFile(configPath string, config interface{})

ConfigFromFile populates the passed &map with config values from given file.

func (ConfigJSON) Unmarshal

func (configJSON ConfigJSON) Unmarshal(configData string, config interface{})

Unmarshal populates the passed &map with config values from given string.

type Configurator

type Configurator interface {
	Unmarshal(configData string, config interface{})
	ConfigFromFile(configPath string, config interface{})
}

Configurator enables provide config adapters for serializer.

func GetConfigurator

func GetConfigurator(name string) Configurator

GetConfigurator lets client of this library fetch required adapter.

type FlatConfig

type FlatConfig map[string]string

FlatConfig can be used seamlessly between varied projects to share flatmap details around configuration.

Jump to

Keyboard shortcuts

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