duct

2019-11-22T15:32:24.253500Z

@ccann: yeah profiles are merged in alphabetical order 😞

2019-11-22T15:33:28.254900Z

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

2019-11-22T15:33:54.255600Z

I did… sorry have been meaning to reply

2019-11-22T15:34:19.256200Z

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

2019-11-22T15:43:20.256900Z

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

kelveden 2019-11-22T16:16:32.257100Z

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.

2019-11-22T16:18:51.257300Z

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.

kelveden 2019-11-22T16:23:55.257500Z

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.

2019-11-22T16:24:56.257700Z

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

👍 1
kelveden 2019-11-22T16:37:39.258200Z

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

2019-11-22T18:09:37.282200Z

it’s a better place than here.

2019-11-22T23:42:23.283800Z

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.

2019-11-22T23:45:06.285400Z

@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