package
0.5.1
Repository: https://github.com/warthog618/config.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

blob

A library for loading configuration files into config.

GoDoc

Blobs represent configuration sources containing configuration stored as a block and in a known format, e.g. config files. Blobs are partitioned into two layers, the Loader, which loads the configuration as a []byte blob from the source, and the Decoder, which decodes the blob into a form that can be used by config.

The Loader may support being watched for changes, and if so the Blob containing it will automatically support being watched for changes as well.

Quick Start

Given a loader and decoder, you create a blob and add it to your config:

    c := config.New(blob.New(file.New("config.json"), json.NewDecoder()))

or add it into your config stack:

    c := config.New(pflag.New(), env.New())
    // ...
    cfgFile := blob.New(file.New("config.json"), json.NewDecoder())
    c.Append(cfgFile)

Loaders

Loaders read configuration from some source.

The following loaders are provided:

LoaderConfiguration Source
bytes[]byte
filelocal file

Decoders

Decoders unmarshal configuration from a particular textual format.

Decoders for the following formats are provided: