config

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Env:  "development",
	Name: "config",
	Type: "yaml",
}

Default viper configuration

View Source
var ErrInvalidConfigType = errors.New("invalid Configuration Type: JSON, YAML, TOML or \"\"(empty string)")

Functions

func New

func New(c ...Config) (*viper.Viper, error)

Create a Viper configuration instance

func NewWithModifier

func NewWithModifier(cfg Config, modifiers ...Modifier) (*viper.Viper, error)

Create a Viper configuration instance with modifiers

Types

type Config

type Config struct {
	ProjectName string
	Env         string
	Name        string
	Type        string
	Paths       []string
}

Configuration struct

type Modifier

type Modifier func(*viper.Viper)

Modifier function

type Type

type Type string
const (
	JSON Type = "json"
	YAML Type = "yaml"
	TOML Type = "toml"
)

func MustParseType added in v1.0.0

func MustParseType(configType string) Type

func ParseType

func ParseType(configType string) (Type, error)

Jump to

Keyboard shortcuts

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