config

package
Version: v0.0.0-...-9d9e229 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppConfigFile string

AppConfigFile defines what app's config file should be used. In case it is specified, BootstrapConfig is not used, because there is not need to search for app's config file It has to be exported var in order to be used in cases such as: rootCmd.PersistentFlags().StringVar(&config.ConfigFile, "config", "", fmt.Sprintf("config file (default: %s)", defaultConfigFile))

Functions

func InitConfig

func InitConfig(bootstrapConfig *BootstrapConfig)

InitConfig initializes application config according to provided BootstrapConfig options and reads in found app's config file and ENV variables if set.

Types

type BootstrapConfig

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

BootstrapConfig specifies how to bootstrap application's configuration. It provides configuration options on:

1. where to look for config files
2. what config file type to look for
3. should ENV VARs be used as config options
... etc

func NewBootstrapConfig

func NewBootstrapConfig() *BootstrapConfig

NewBootstrapConfig

func (*BootstrapConfig) AddLinuxPaths

func (c *BootstrapConfig) AddLinuxPaths(rootPaths, homeRelativePaths []string) *BootstrapConfig

AddLinuxPaths

func (*BootstrapConfig) AddWindowsPaths

func (c *BootstrapConfig) AddWindowsPaths(rootPaths, homeRelativePaths []string) *BootstrapConfig

AddWindowsPaths

func (*BootstrapConfig) SetConfigFile

func (c *BootstrapConfig) SetConfigFile(file string) *BootstrapConfig

SetConfigFile

func (*BootstrapConfig) SetConfigType

func (c *BootstrapConfig) SetConfigType(_type string) *BootstrapConfig

SetConfigType

func (*BootstrapConfig) SetEnvVarPrefix

func (c *BootstrapConfig) SetEnvVarPrefix(prefix string) *BootstrapConfig

SetEnvVarPrefix

type PathOptions

type PathOptions map[string]PathSet

PathOptions specifies set of PathSet's for different platforms. Ex.: pathOptions["linux"] = PathSet with Linux paths pathOptions["windows"] = PathSet with Windows paths

type PathSet

type PathSet map[string][]string

PathSet specifies set of paths to be used to find configuration. Ex.:

pathSet["root"] = /etc, /etc/somedir
pathSet["home"] = home-relative dirs, ex.: .atlas-config, .atlas-client

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL