Documentation ¶
Index ¶
- Constants
- type Conf
- type Configurer
- func Data(data []byte, dec DecoderFunc) Configurer
- func File(path string, dec DecoderFunc) Configurer
- func FileFS(fsys fs.FS, path string, dec DecoderFunc) Configurer
- func Read(r io.Reader, dec DecoderFunc) Configurer
- func TryFile(path string, dec DecoderFunc) Configurer
- func TryFileFS(fsys fs.FS, path string, dec DecoderFunc) Configurer
- type ConfigurerFunc
- type DecoderFunc
- type Secret
Constants ¶
const ErrStructPointerExpected = internal.ErrStructPointerExpected
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conf ¶
type Conf struct {
// contains filtered or unexported fields
}
func Configure ¶
func Configure(v interface{}, proc ...Configurer) (*Conf, error)
func MustConfigure ¶
func MustConfigure(v interface{}, proc ...Configurer) *Conf
MustConfigure calls Configure and handles any possible returned error from it, resulting in either: - no error; - an exit of the program if Configure returns a cli.FlagError; - a panic on all other non-nil returned errors.
func New ¶
func New(proc ...Configurer) *Conf
type Configurer ¶
type Configurer interface {
Configure(v interface{}) error
}
A Configurer can
func Data ¶
func Data(data []byte, dec DecoderFunc) Configurer
Data wraps the data in a bytes.Buffer and sends it to Read.
func File ¶
func File(path string, dec DecoderFunc) Configurer
File reads a file and decodes its data stream with the provided decoder. It expects the file to exist and returns an error when it cannot be opened.
func FileFS ¶
func FileFS(fsys fs.FS, path string, dec DecoderFunc) Configurer
FileFS reads a file from a fs.FS and decodes its data stream with the provided decoder. It expects the file to exist and returns an error when it cannot be opened.
func Read ¶
func Read(r io.Reader, dec DecoderFunc) Configurer
Read from io.Reader r and decode the data stream with the provided decoder.
func TryFile ¶
func TryFile(path string, dec DecoderFunc) Configurer
TryFile tries to read a file and decodes its data stream with the provided decoder. It won't return an error if the file cannot be opened.
func TryFileFS ¶
func TryFileFS(fsys fs.FS, path string, dec DecoderFunc) Configurer
TryFileFS tries to read a file from a fs.FS and decodes its data stream with the provided decoder. It won't return an error if the file cannot be opened.
type ConfigurerFunc ¶
type ConfigurerFunc func(v interface{}) error
func (ConfigurerFunc) Configure ¶
func (f ConfigurerFunc) Configure(v interface{}) error
type DecoderFunc ¶
type Secret ¶
type Secret string
Secret can be either a string containing the secret or a file to read the secret string from. This is particularly useful when used with docker swarm secrets. See https://docs.docker.com/engine/swarm/secrets/ for additional information.
func (Secret) IsPath ¶
IsPath returns true if Secret is a path to a secrets file, otherwise it returns false. It does not verify if a file exists or is readable.
func (Secret) ReadString ¶
ReadString returns the content of Secret as string.