duct-framework / duct

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

Duct 0.11.0-beta2 refs aren't merged with maps #80

Closed scottlowe closed 5 years ago

scottlowe commented 5 years ago

When extra config keys are added to a ref from within included files, the refs don't appear to be merged correctly. This works as expected in the stable version of Duct.

I have attached an example shell of a Duct app here: fez.zip

In the included file pizza.edn, the :fez.core/pizza-sauce key's value is given as a ref:


:fez.core/pizza-sauce #ig/ref :fez.core/special-sauce 

Then, in bbq-pizza.edn, additional keys are added to map that shares the :fez.core/pizza-sauce ref key:


 :fez.core/pizza-sauce {:wood-smoke true
                        :mollasses true}

The result prepped config does not have the ref key namespaced or merged correctly:


:fez.core/pizza-sauce {:wood-smoke true
                       :mollasses true
                       :key :fez.core/special-sauce}

Old and new duct configs compared:

;; duct stable, prepped

{:duct.core/project-ns fez,
 :fez.core/pizza-sauce #integrant.core.Ref{:key :fez.core/special-sauce, :wood-smoke true, :mollasses true},
 :fez.core/pizza {:dough 12, :sauce #integrant.core.Ref{:key :fez.core/pizza-sauce}},
 :fez.core/special-sauce {:tomatoes true, :salt true},
 :duct.core/include ["pizza" "bbq-pizza" "fez/config" "dev"],
 :duct.core/environment :development}

;; duct beta, prepped

{:duct.core/project-ns fez,
 ;; the problem is here vvv
 :fez.core/pizza-sauce {:wood-smoke true, :mollasses true, :key :fez.core/special-sauce},
 :fez.core/pizza {:dough 12, :sauce #integrant.core.Ref{:key :fez.core/pizza-sauce}},
 :fez.core/special-sauce {:tomatoes true, :salt true},
 :duct.core/environment :development}