gov.usgs.eros:lcmap-config

LCMAP Configuration Library


Licenses
NASA-1.3/SSPL-1.0

Documentation

lcmap.config

Build StatusDependencies StatusClojars Project

Unified Configuration for the LCMAP System of Systems

LCMAP open source project logo

Contents

About ↟

This 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..

Documentation ↟

The LCMAP configuration system API reference is slowly being updated with docstrings. The project's auto-generated documentation is available here:

Usage ↟

In order to use lcmap-config you need to:

  1. Add a dependency to project.clj
  2. Define a schema to coerce and validate values
  3. Add keys/values to lcmap.ini
  4. Update your components

project.clj Dependency ↟

[lcmap-config 0.5.0-SNAPSHOT]

Defining a Config Schema ↟

For 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 File ↟

By 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 & Configuration ↟

LCMAP 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.

License ↟

Copyright © 2015-2016 United States Government

NASA Open Source Agreement, Version 1.3