Funny, We implemented something similar using zookeeper (thanks to David for zookeeper-clj). We store data as Clojure expressions. This was a move to have a cluster unified view of configuration data and go away from alien representations (we used Yaml in several places).
I can't see the added value of using an alien format except if you intend to share it with an environment where Clojure is not available. We decided to bridge the gap by calling Clojure to access configuration from either JRuby or Java when needed. In both cases, map and collection interfaces saves us the translation. Luc > Hi Robert, > > Everything looks good, thanks for sharing the library. A philosophical > > question, why YAML and not JSON or raw clj? > > Cheers, Jay > > On Jun 22, 2012, at 7:30 PM, Robert Levy wrote: > > > It is my pleasure to announce the 0.5.0 release of milieu, a library for > > > environment-based application configuration that I have developed and > > > actively maintain at Draker in Burlington, Vermont. Having made use of > > > it in our day-to-day work for several months now, we have found this > > > library to be very useful for managing configuration in our proprietary > > > time-series data acquisition back-end systems (also all written in > > > Clojure of course). I think this library will add value to applications > > > in any domain. > > > > The source can be found at https://github.com/drakerlabs/milieu and the > > > > leiningen / maven dependency information is at > > > > http://clojars.org/milieu. Issues/feedback and pull requests are of > > > > course welcome! > > > > milieu > > The environmentally friendly configuration tool. > > > > Build status: > > > > Features: > > Set up environment-specific configuration for your Clojure application, > > using the popular YAML file format. > > > > Access config values: > > > > Specifying config values: > > > > (config/value :my :config :value) > > This will access the value in > > > > dev|test|...: > > my: > > config: > > value: > > Specifying config values as optional: > > > > (config/value| :my :config :value) ; same as config/value except > > > > doesn’t warn if it’s not found > > (config/value| [:my :config :value] "alternate value") ; provide alternate > > value > > Optionally auto-load config file. > > > > using the default filename of "configure.yml" enables autoload > > any other config file name can be specified by calling load-config > > Bind the environment within a calling context using with-env. > > > > (config/with-env env > > (when (config/value :some :setting) ... )) > > Specify the default environment using the MILIEU_ENV system variable. > > > > Override environment-specific settings using arguments to your > > > > command-line application. > > > > (config/commandline-overrides! args) > > (config/with-env env > > ... ) > > In cases where the environment can be variable, code evaluation can by > > restricted in with-env or only-env, or more generally conditional using > > if-env and when-env. > > > > ;; If env is prod, the code in the body will not be exercised, > > ;; an exception is thrown instead: > > (defn -main [env & args] > > (config/with-env [env :only [:test :dev]] ,,,)) > > Alternatively (for example if you aren't in the context of a with-env)... > > > > ;; If env is prod, the code in the body will not be exercised, > > ;; an exception is thrown instead: > > (config/only-env [:test :dev] ,,,) > > The following forms are general purpose conditionals (not assertions of > > environment restrictions). > > > > (config/if-env :test "hello" "goodbye") > > (config/when-env :dev ,,,) > > Helpful info / warnings that can be turned off with MILIEU_QUIET system > > variable: > > > > WARNING: system variable MILIEU_ENV was not set. Default value will be > > > > "dev" > > > > WARNING: requested config setting [:fou :barre] not found! > > > > INFO: to enable auto-load, name your config-file configure.yml. > > > > Use > > Installation > > > > http://clojars.org/milieu > > > > Getting Started > > > > (ns example.core > > (:require [milieu.config :as config])) > > Example > > > > (defn -main [env & args] > > (config/commandline-overrides! args) > > (config/with-env env > > (when (config/value| :some :setting) ,,, > > Command-line Override > > > > $ myprogram prod --fou.barre Fred --some.setting 127.0.0.1 > > License > > Author: Robert Levy / @rplevy-draker > > > > Acknowledgments: @alanpeabody, @S11001001, @AlexBaranosky > > > > Copyright © 2012 Draker Labs > > > > Distributed under the Eclipse Public License, the same as Clojure. > > > > -- > > You received this message because you are subscribed to the > > > > Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en