A Babashka library for handling configuration from multiple sources with a unified interface.
- Configuration management from multiple sources:
- Command-line arguments (using docopt)
- YAML configuration files
- Environment variables
- Default values
- Automatic configuration merging with precedence
- Simple and declarative configuration setup
Add to your deps.edn
or bb.edn
:
{:deps {200ok-ch/shell-smith {:git/url "https://github.com/200ok-ch/shell-smith"
:sha "current-sha"}}}
(ns my-app.core
(:require [shell-smith.core :as smith]))
(def usage "
Usage:
app [--port <port>]
app (-h | --help)
Options:
-h --help Show this screen
--port <port> Port number [default: 3000]
")
(def config
(smith/config usage
:name "myapp"))
- Command line arguments
- Environment variables (prefixed with uppercase app name)
- YAML configuration file
- Default values
Create a myapp.yml
in your working directory:
port: 8080
Environment variables should be prefixed with the uppercase app name:
MYAPP_PORT=9000
tbd.