If you end up using a separate config file rather than project.clj, you might
find Carica https://github.com/sonian/carica <https://github.com/sonian/carica>
useful. It allows merging config files on the classpath into one effective
config hierarchy with predictable overriding behavior.
Sample calls:
(carica/config :db) => {:classname “org.postgresql.Driver”, :subprotocol
“postgresql”, … }
(carica/config :db :classname) => “org.postgresql.Driver”
A typical use is to have a config file for a server or library in the shipped
jar file that contains defaults and a runtime classpath that allows that config
to be overridden by a config file laid down during deployment.
The deployed config file needs to contain keys for the key paths that need to
be overridden, not the entire hierarchy.
—Steve
> On Apr 19, 2016, at 12:04 PM, Facundo Olano <[email protected]> wrote:
>
> Hi! I started to use clojure a couple of months ago and now I'm struggling to
> extract a little library from a larger project I'm working on.
>
> The lib is a gettext-like tool that allows translating strings based on a
> translations dictionary. I'd like to be able to include the lib as a
> dependency of the larger project and point to my translations dictionary from
> a setting in a configuration file (Ideally I would use project.clj to avoid
> having a lib specific file just for one setting).
>
> My problem is I'm not sure how to read a configuration file in my project
> from the generated JAR of the lib (if that's even possible and not a bad idea
> for some reason). I tried using configleaf
> <https://github.com/davidsantiago/configleaf> and it worked while I included
> the lib as a checkout project but it seems the config file gets freezed to
> whatever it is when the lib's JAR is packed.
>
> I wonder if there's a straightforward and idiomatic way to achieve this.
> "That's a terrible idea" type of answers are also welcome :P
>
> Thanks,
> Facundo.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> <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 [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.