Liking cljdoc? Tell your friends :D

stavka

Build Status Clojars License Donate

Stavka (Ставка) is the high command of your clojure application, which manages configuration from various sources.

This project is still a work in progress. Not all APIs were implemented.

Usage

(require '[stavka.core :as sta :refer :all])

(def config
    ;; load configuration from multiple sources and merge them like
    ;; clojure.core/merge.
    (sta/using
        ;; using environment variables by default
        (env)
        ;; also load properties from classpath
        (properties (classpath "/default.properties"))
        ;; load another properties from filesystem, and watch is for change
        (properties (watch (file "/etc/stavka.properties")))
        ;; and fetch a remote json configuration. check every 10 seconds
        ;; for update.
        (json (poll (url "http://somehost/configuration/my.json") 10000))))

;; get configuration
($ config :some.config.key)

Features

  • Extensible configuration sources and formats
    • Sources:
      • Classpath
      • File system
      • URL
      • JDBC (to be provided as example of extending stavka)
    • Formats:
      • Environment variables
      • JVM options (-D)
      • JSON
      • YAML
      • Properties
  • Reloading by
    • Watching file system
    • Polling the source
    • JMX
  • Listeners for source changing
  • Type conversion

License

Copyright © 2018 Ning Sun

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Donation

I'm now accepting donation on liberapay, if you find my work helpful and want to keep it going.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close