I've been using carica (https://github.com/sonian/carica) and have config 
map like {:dev <...> :prod <...>} and just using a single environmental 
variable to determine which of those config maps to use. 

On Friday, January 17, 2014 5:06:31 AM UTC-8, Malcolm Sparks wrote:
>
> There's also Jig : https://github.com/juxt/jig
>
> Jig's recommendation is for configuration to be held in EDN files.
>
> I much prefer EDN over environment variables. Environment variables feel 
> awkward when there you have lots of configuration, usually in the form of a 
> tree.
>
> Usually it makes sense to have one configuration file per environment. 
> That can make it hard to keep configuration files up to date, so judicious 
> use of the #=() Clojure reader macro can allow you to programmatically 
> deviate from a default configuration - often the delta from a default 
> configuration is more informative. There are more details in Jig's 
> README.md file.
>
> I agree with the comments against using dynamic vars. They reduce the 
> ability to reason about functions and are precarious when dealing with 
> threads - binding conveyance is tricky and small mistakes can lead to 
> elusive bugs.
>
> I pass configuration as a single argument into types/records that declare 
> lifecycle methods. I have found this pattern to serve me well in over a 
> dozen projects. Since stumbling on this pattern I have had no need to 
> resort to dynamic vars for environment config, and my projects have been 
> smaller, more reliable and easier to reason about.
>
>
> On Tuesday, January 14, 2014 9:04:45 AM UTC, James Trunk wrote:
>>
>> Thanks for all the great links and ideas you have all posted, now I have 
>> plenty of reading and thinking to do!
>>
>> > I am curious about what you mean by 'thread safety'.
>> Perhaps "thread safety" is the wrong term, but what I meant was the 
>> limitations dynamic binding introduces around thread dispatching, which 
>> Stuart Sierra explains in this blog 
>> post<http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope>
>> .
>>
>> Cheers,
>> James
>>
>> On Monday, January 13, 2014 7:10:38 PM UTC+1, Stefan Kanev wrote:
>>>
>>> On 13/01/14, James Trunk wrote: 
>>> > The downsides to dynamic vars seem to be: hiddenness, thread safety, 
>>> and 
>>> > more complex tests (binding before each test). 
>>>
>>> I am curious about what you mean by 'thread safety'.  As far as I know, 
>>> dynamic variables are thread-local, which means that they are 
>>> thread-safe, at least to some extend.  I assume you mean something 
>>> specific? 
>>>
>>> -- 
>>> Stefan Kanev  ¦  @skanev  ¦  http://skanev.com/ 
>>> If a program manipulates a large amount of data, it does so in a small 
>>> number 
>>> of ways. 
>>>
>>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to