config-manager-0.1.0.0: Configuration management

LicenseGPL-3
MaintainerJoris Guyonvarch <joris@guyonvarch.me>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Data.ConfigManager

Contents

Description

A configuration management library.

Synopsis

Configuration file format

A configuration file consists of a series of:

  • bindings,
  • imports,
  • and comments.

Binding a name to a value

A binding associates a name to a value:

number = 1
my-string = "Hello"
a_double = 4.0
thatIsABoolean = True
a_double = 5.0

If two or more bindings have the same name, only the last one is kept.

Import other files

An import is either required or optional:

import "database.conf"
importMaybe "local.conf"

Comments

A comment begins with '#' and continues to the end of the line:

# Comment
x = 8 # Another comment

Configuration loading

Lookup functions

lookup :: Read a => Name -> Config -> Either Text a Source

Lookup for the value associated to a name.

lookupDefault :: Read a => a -> Name -> Config -> a Source

Lookup for the value associated to a name and return the default value if no binding exists with the given name.