Yummy allows reading in configuration from YAML files and provides optional facilities for:
clojure.spec
Yummy only provides YAML parsing, no generation facilities are present.
Auto determined configuration file paths:
(spec/def ::config (spec/keys :req-un [::http ::logging ::database]))
(yummy.config/load-config {:program-name :mydaemon :spec ::config})
Yummy will look for a configuration-file path in the
mydaemon.configuration
system property or the
MYDAEMON_CONFIGURATION
environment variable.
A path can outright be given as well:
(spec/def ::config (spec/keys :req-un [::http ::logging ::database]))
(yummy.config/load-config {:path "/etc/mydaemon.yml" :spec ::config})
Alternately configuration can be loaded from a string:
(yummy.config/load-config-string "a: b" {})
To make integration as simple as possible, Yummy understands a number of custom tag parsers, namely:
envdir
: loads a map from a directory, treating file names as keys and content as valuesenvvar
: loads a value from the environment, optionally taking in defaultskeyword
: coerce a string to a keywordenvfmt
: produce a string from a format string and environment variables to pull inslurp
: produce a string from the given file contentuuid
: produce a UUID from the given stringa: !keyword b
b: !envvar HOME
c: !envvar [NOPE, hello]
d: !envdir /tmp/foo
e: !envfmt ["user=%s, home=%s", USER, HOME]
f: !slurp "/etc/hostname"
g: !uuid fc716a9b-fb1e-4ebd-b781-5ca13039aa55
http://exoscale.github.io/yummy
[[exoscale/yummy "0.2.6"]]
Can you improve this documentation? These fine people already did:
Yoan Blanc & Pierre-Yves RitschardEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close