config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceParse

func ForceParse(structPointer any)

func ForceParseByKey

func ForceParseByKey(key string, structPointer any)

func Init

func Init(opts ...ConfigOption) error

func Parse

func Parse(structPointer any) error

func ParseByKey

func ParseByKey(key string, structPointer any) error

Types

type Config

type Config struct {
	Environment  EnvironmentType
	ConfigFile   ConfigFile
	AutoParseEnv bool
	// WeakMatchName ignore difference between camelCase, snake_case, etc.
	WeakMatchName bool
}

type ConfigFile

type ConfigFile struct {
	Name string
	Type string
	Path string
}

type ConfigOption

type ConfigOption func(*Config)

type EnvironmentConfig

type EnvironmentConfig struct {
	Environment EnvironmentType `env:"ENVIRONMENT" envDefault:"TEST"`
}

type EnvironmentType

type EnvironmentType string
const (
	Debug EnvironmentType = "DEBUG"
	Test  EnvironmentType = "TEST"
	Prod  EnvironmentType = "PROD"
)

func Environment

func Environment() EnvironmentType

Jump to

Keyboard shortcuts

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