lcmap.config
Unified Configuration for the LCMAP System of Systems
Contents
↟
AboutThis project provides helpers to parse, coerce, and validate values from a variety of sources (INI, EDN, CLI, ENV). It also supplies configuration component in order to make it easy to supply other components with configuration values..
↟
DocumentationThe LCMAP configuration system API reference is slowly being updated with docstrings. The project's auto-generated documentation is available here:
↟
UsageIn order to use lcmap-config you need to:
- Add a dependency to project.clj
- Define a schema to coerce and validate values
- Add keys/values to lcmap.ini
- Update your components
project.clj
Dependency ↟
[lcmap-config 0.5.0-SNAPSHOT]
↟
Defining a Config SchemaFor example:
(ns lcmap.project.config)
(def cfg-schema
{schema/Keyword schema/Any})
(def defaults
{:ini *lcmap-config-ini*
:args *command-line-args*
:schema cfg-schema})
↟
Configuration FileBy default LCMAP projects read configuration from $HOME/.usgs/lcmap.ini
.
The convention is to create a section based on the project's namespace. For example, the lcmap-data project expects a section called lcmap.data
:
[lcmap.data]
db-hosts=host1, host2, host3
↟
Components & ConfigurationLCMAP projects expect the configuration component to be associated with a key of :cfg
in the system map.
(component/system-map
...
:cfg (component/using
(config/new-configuration opts)
[]))
...)
Use the first and second level namespace ... wording ... e.g. lcmap.data
, lcmap.rest
, lcmap.client
, etc.
↟
LicenseCopyright © 2015-2016 United States Government
NASA Open Source Agreement, Version 1.3