2011/5/23 Chas Emerick <cemer...@snowtide.com>:
>
> On May 23, 2011, at 3:48 AM, Laurent PETIT wrote:
>
>> So far, the "most" general techniques I can see are : either
>> bundle/repackage your webapp for the target servlet container
>> instance, either pass the path to configuration file(s) via one (or
>> more) JNDI parameters.
>
> That's about right — though of course you don't need to be using JNDI if 
> you're willing to configure each parameter separately as a system property or 
> servlet init param.

Well, passing parameters as system properties is out of scope as far
as I'm concerned: for example, it prevents the ability to deploy the
same webapp twice on the same container.
And it requires you to tweak the starting script of the servlet
container, and this thought makes me cringe.

As far as servlet init params are concerned I see this just as a
detail of the first general solution I described: "bundle/repackage
your webapp for the target servlet container instance", where
repackaging would mean, probably, a custom version of web.xml.

> Beyond that, ring is quite container-agnostic (to the point where you don't 
> necessarily need to use a servlet container to deploy ring apps), whereas 
> configuration mechanisms are likely to be container-specific.

Since the "extra classpath entries per deployed webapp" trick is not
(AFAIK) normalized in JEE, sadly, yes.

For the record, here is what I've come up with, for my particular
application : I'm leveraging this "extra-classpath entry ...." trick
of Tomcat, and in my server_info.clj namespace, I have something like
this:

;; server_info.clj

(try
  (load "server_data")
  (catch Exception e
    (warn "... explanation ... no specific configuration file found in
classpath ... will use default values instead ..")))

(defonce data1 { ... }) ;; innocuous value, maybe only relevant to dev
environment as a default
(defonce data2 { ... }) ;; defonce used to make sure that if the value
is set in server_data, it's not overriden

And it's up to the "operations team" to provide, in a way or another
;; server_data.clj
(def data1 { ... })
(def data2 { ... })

Cheers,

-- 
Laurent

-- 
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

Reply via email to