config

package
v0.0.0-...-90ceb82 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PossibleSaveLocations = []string{"$HOME/.cogo", "$HOME/.config/.cogo", "./.cogo"}

PossibleSaveLocations is a list of all locations that is currently supported Not entirely sure this is what I want.. I think I want to use an enum

Functions

func Config

func Config() (Provider, *AppError)

Config returns a default config providers

Types

type AppError

type AppError struct {
	Error   error
	Message string
	Code    int
}

AppError is The default config error

type Configurations

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

Configurations is the structure of the config file

type Provider

type Provider interface {
	ConfigFileUsed() string
	Get(key string) interface{}
	GetBool(key string) bool
	GetDuration(key string) time.Duration
	GetFloat64(key string) float64
	GetInt(key string) int
	GetInt64(key string) int64
	GetSizeInBytes(key string) uint
	GetString(key string) string
	GetStringMap(key string) map[string]interface{}
	GetStringMapString(key string) map[string]string
	GetStringMapStringSlice(key string) map[string][]string
	GetStringSlice(key string) []string
	GetTime(key string) time.Time
	InConfig(key string) bool
	IsSet(key string) bool
}

Provider defines a set of read-only methods for accessing the application configuration params as defined in one of the config files.

func LoadConfigProvider

func LoadConfigProvider(appName string) Provider

LoadConfigProvider returns a configured viper instance

Jump to

Keyboard shortcuts

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