duct-framework / duct

Server-side application framework for Clojure
MIT License
1.13k stars 51 forks source link

:duct.profile/base VS :duct.profile/prod #109

Closed jimpil closed 4 years ago

jimpil commented 4 years ago

My intuition was that the prod map is deep-merged with the base one, but that doesn't seem to be the case. During dev time, my :my.app.logging/timbre (present in both base and prod profiles) gets initialised, but when I use the -main method (via lein run), it doesn't.

The use case is as follows... During dev time (and generally in the base profile), I only want the println appender. In prod, I want both the println and my own file-rolling-appender. Shouldn't I be able to use the same key in both profiles, specifying a single appender in each, and end-up having two appenders when the final config is assembled? Or is there a different way/idiom for doing this?

Many thanks in advance...:)

weavejester commented 4 years ago

Your intuition is correct; the production profile is merged onto the base profile, with the production profile taking priority.

Without seeing some of your code I can only guess as to what might be going wrong, however it may be that your key isn't being initialized in production because it's references by a key derived from :duct/daemon.

In development, all keys are run by default. However, in production only keys derived from :duct/daemon or keys referenced by those keys, are started.

jimpil commented 4 years ago

Yeah, that was it...My key was not derived from :duct/deamon... However instead of manually deriving it in the middle of a random namespace, I realised I can simply add my key in the vector of keys passed to exec-config (which by default has only :duct/deamon in).

Many thanks for your prompt response and clear answer :+1:

weavejester commented 4 years ago

However instead of manually deriving it in the middle of a random namespace

Incidentally, that's what duct_hierarchy.edn is for.

jimpil commented 4 years ago

Nice one - even cleaner :)