He pulled out a battered red journal and proffered it unsteadily. Gilt took it, and flicked it open. His eye ran down the entries. ‘You wrote everything down, Crispin?’ he said. ‘Why?’ Crispin looked appalled. ‘Got to keep records, Reacher,’ he said. ‘Can’t cover y’tracks if you don’t know where y’left ‘em.
Crispin is a library for managing project wide configuration.
An optimized version of this library for Dunaj can be found in
Dunaj branch of this project.
Configuration map is assumed immutable and can be safely cached. Configuration is static. When the config changes, service should be restarted. Design choice is to have stateless fail-fast services, that have their configuration stored on various places.
Main feature is to provides map merged from various sources, in following order:
Configuration file in the root classpath
Configuration files within classpath starting from user defined namespace
Project specific environment variables (set e.g. in lein project.clj or profiles.clj) Users must use
lein-environplugin to enable this
Environment variables, translating keys
Java system properties, translating keys
Custom configuration resources pointed from [:crispin] property, guessing format from filename, defaulting to .edn
All data is merged into one map and keys are translated to the hierarchy of keywords. This will either be perfect to your project or not useful at all.
Accepted file names for configuration files, loaded in following order:
Supports fetching external resources with #crispin.core/resorce "url" format.
Conflicts when merging branch and non-branch nodes are resolved into creation of branch node with previous non-branch node put under nil key.
Accepts map with types that parses values into desired format, such as integer, keyword, vector, etc.
cfg - does all the magic mentioned above and returns ordinary immutable map
Copyright © 2015, Jozef Wagner.
The use and distribution terms for this software are covered by the [Eclipse Public License 1.0](http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by the terms of this license.
You must not remove this notice, or any other, from this software.