configs

package module
v0.0.0-...-9f22415 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvFile = ".env"
View Source
var FileExtensions = map[string]func(data []byte, v any) error{
	".json": json.Unmarshal,
	".yaml": yaml.Unmarshal,
}

Functions

func LoadDotenv

func LoadDotenv() error

func Read

func Read(i any, envPrefix string, file string) (err error)

func ReadFromFile

func ReadFromFile(i any, filename string) error

Types

type Config

type Config struct {
	Value          any
	Overwrites     Overwrites
	EnvPrefix      string
	File           string
	IgnoreEnv      bool
	IgnoreDotEnv   bool
	OverwritesFile string
	// contains filtered or unexported fields
}

func (*Config) Overwrite

func (c *Config) Overwrite(ov Overwrites) error

func (*Config) Read

func (c *Config) Read() (err error)

func (*Config) ReadFromEnv

func (c *Config) ReadFromEnv(i any, prefix string) error

func (*Config) UnusedEnvKeys

func (c *Config) UnusedEnvKeys() []string

func (*Config) UsedEnvKeys

func (c *Config) UsedEnvKeys() []string

type EnvTag

type EnvTag struct {
	Name string
}

func ParseEnvTag

func ParseEnvTag(tag string) (EnvTag, error)

type Overwrites

type Overwrites map[string]any

func ReadOverwritingFile

func ReadOverwritingFile(cfg any, filename string) (ov Overwrites, err error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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