config

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal added in v0.3.0

func Marshal(in interface{}, fileExt string) ([]byte, error)

Marshal converts the passed object into byte data, based on the specified file format

func MergePluginCfg

func MergePluginCfg(pluginName string, h *CfgHandler, pluginCfg interface{}) error

MergePluginCfg adds config of specified plugin into the host CLI config struct.

func Unmarshal added in v0.3.0

func Unmarshal(in []byte, out interface{}, fileExt string) error

Unmarshal converts the passed byte data into a struct

Types

type CfgHandler

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

CfgHandler defines the fields required to manage config.

func NewHandler

func NewHandler(path string, cfg interface{}) *CfgHandler

NewHandler links the specified arguments to a new instance of config handler and returns a pointer to it.

func (*CfgHandler) Load

func (h *CfgHandler) Load() error

Load reads config values from the local config file (using the file path linked to the handler) and stores them into the linked instance of host CLI config struct.

func (*CfgHandler) Save

func (h *CfgHandler) Save() error

Save writes config values from the linked instance of host CLI config struct to the local config file (using the file path linked to the handler).

Jump to

Keyboard shortcuts

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