A Clojure library designed to use Netflix/archaius for configuration management.
Leiningen dependency:
[cn.leancloud/clj-archaius "0.4.1"]
Require clj-archaius in your namespace:
(require '[clj-archaius.core :refer :all])
Asume that you have a config.properties
file in your project resource path:
a=1
b=2.0
c=hello\ world
You can get these properties by:
(int-env :a)
(double-env :b)
(env :c) ;;or (string-env :c)
With a default value if the property is not present:
(int-env :not-exists 100)
Add a callback listener to be notified when the property is changed:
(on-int-env :a (fn [] (println "The new :a is " (int-env :a))))
Supported types and their default values as below:
'int 0
'string nil
'boolean false
'double 0
'float 0
'long 0
All these types have {type}-env
function to retrieve property value and on-{type}-env
function to add a callback listener to be notified when the property is changed.
Copyright © 2015 dennis zhuang
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation? These fine people already did:
dennis zhuang & liuchongEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close