Skip to content

merge-configs doesn't allow explicit set of nil value #29

Description

@dhryniewicz

merge-configs function, deeper down, uses a pick-prioritized function that, among other scenarios, picks a non-nil value over a nil value. I suppose this is to deal with k-v pairs missing in one of the maps.
But there are scenarios when one might want to explicitly set value of something to nil (like for :logger for instance). And sadly this is not possible:

(duct.core/merge-configs
  {:duct.database.sql/hikaricp {:logger nil
                                :something-else :yay}}
  {:duct.database.sql/hikaricp
   ^:demote {:jdbc-url "123"
             :logger "999"}})
=> #:duct.database.sql{:hikaricp {:jdbc-url "123", :logger "999", :something-else :yay}}

Probably at one point Duct should be using a contains? function instead of nil? or some? at some point. I'm looking at these two lines.

Would you consider that a bug? merge-configs fn tests don't include it so I'm not sure 🤔

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions