config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 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

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 ParseType

func ParseType(configType string) (Type, error)

Parses configuration type Allowed types: json, yaml, toml If empty string is passed it returns yaml

Jump to

Keyboard shortcuts

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