Fork me on GitHub
#duct
<
2019-11-22
>
rickmoynihan15:11:24

@ccann: yeah profiles are merged in alphabetical order 😞

weavejester15:11:28

Incidentally, @rickmoynihan, did you look over my reply to that issue?

rickmoynihan15:11:54

I did… sorry have been meaning to reply

weavejester15:11:19

No problem. I’ve been meaning to put together a document listing pros and cons of the approach.

weavejester15:11:20

I’ve added a pros/cons message. Let me know if I’ve missed out any advantages or disadvantages that you can think of.

kelveden16:11:32

Is it possible to conditionally include a module? Specifically I'm wanting to define a module but only in the dev profile - i.e. when in prod the module will not be created.

weavejester16:11:51

Not currently, but there are plans to make that a possibility. As a workaround, you can always write a module that only activates on a certain key. In your case, you could have the module look for the :duct.core/environment key. That’s added automatically by the :duct.profile/dev profile.

kelveden16:11:55

Thanks @weavejester. That's an interesting idea. I think I could certainly work with that although I suspect that it may not solve everything perfectly as what I also want to do is only include the dependencies for that module in leiningen "dev" profile - (i.e. in "test" scope in Maven parlance). I'll give it a go though and will report back.

weavejester16:11:56

For reference, there’s a discussion on reworking profiles here: https://github.com/duct-framework/core/issues/31

👍 4
kelveden16:11:39

Thanks that worked. For completeness, here's what my module init-key now looks like:

(defmethod ig/init-key :duct.module/my-module [_ opts]
  (fn [config]
    (let [environment (::duct/environment config :production)]
      (if (= :development environment)
        (duct/merge-configs
          config
          (build-config opts))
        config))))

rickmoynihan18:11:37

it’s a better place than here.

weavejester23:11:23

Thanks @rickmoynihan. I posted a response. I’d also like to invite anyone else who’s been using Duct for a while to take a look at that issue and tell me what they think.

weavejester23:11:06

@iarenaza If you have time, I’d be interested to hear from the folks at Magnet about their opinion on issue: https://github.com/duct-framework/core/issues/31