This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-18
Channels
- # beginners (17)
- # calva (1)
- # clara (1)
- # cljs-dev (12)
- # clojure (151)
- # clojure-france (11)
- # clojure-uk (6)
- # conjure (4)
- # datomic (32)
- # duct (42)
- # emacs (2)
- # fulcro (20)
- # lambdaisland (4)
- # malli (5)
- # meander (32)
- # pathom (8)
- # reagent (1)
- # reitit (7)
- # shadow-cljs (2)
- # sql (6)
- # tools-deps (2)
- # vim (17)
- # xtdb (1)
Hello, I'm new to duct and was wondering if someone could help me with some project setup. I'm following https://github.com/duct-framework/duct/wiki/Configuration instructiong but based on https://github.com/duct-framework/duct/wiki/Configuration#configedn section is looks like they are a little out of date since the default config doesn't look like that (unless I've gotten a base version). My problem is that following the instructions as they are https://github.com/duct-framework/duct/wiki/Configuration#completed-configuration my completed configuration isn't overwriting :duct.core/environment
with :development
as I would hope. My project is all default stuff except I have replaced {}
with
{:duct.core/environment :development
:duct.core/include ["image_service/config"]}
in dev/resources/dev.edn
per the README. I would assume that when I run (duct/prep-config (read-config) profiles)
(from the default dev namespace) it would merge the dev config and replace the environment config. Does anyone know what I'm missing here?Have you seen this one? https://github.com/duct-framework/docs/blob/master/GUIDE.rst
I think I'm going to backup / delete the outdated section, and reference the guide I just linked
Also, be sure to update your packages after you generate a new Duct project (with for example lein ancient)
Hmm, I don't see anything in regards to dev configurations in this guide. I'd be more than willing to write it once I figure it out though
The way dev configuration works is with the profiles system. For example in the config.edn
file there is the following like:
:duct.profile/dev #duct/include "dev"
If the :duct.profile/dev
key is passed in the duct.core/exec-config
or duct.core/prep-config
function, then that profile's EDN file gets merged into your base profile
The following two definitions should be in your dev.clj
file
(def profiles
[:duct.profile/dev :duct.profile/local])
(integrant.repl/set-prep! #(duct/prep-config (read-config) profiles))
Which will make sure that the dev.edn
file gets merged into your base config during development
Yes, those are there. When I run (duct/prep-config (read-config) profiles)
I can see that my dev config has been picked up correctly, but it doesn't seem to be merging it into the base
If you're seeing the keys in the resulting config, but they aren't being merged into your base, then that's probably the issue
My dev edn is
{:duct.core/environment :development
:duct.core/include ["image_service/config"]}
Actually, I may still be operating off of suggestions from that old README. If I want duct.core/environment
to default to :production
would I put that in the base or in the top level?
Does your base have the following format?
{:duct.profile/base
{:duct.core/project-ns my-app
,,,}
:duct.profile/dev #duct/include "dev.edn"}
Also, in terms of the difference between keys inside of the base config vs outside of the base config:
Any keys outside of the base config are "duct module" keys. These are initiated during preperation (`duct/prep-config`), and modify the base config somehow. All module keys' ig/init-key
return a function (fn [config] config)
where the fn
modifies config
(base config)
Might be a bit confusing at first, but I'm not sure if there's any documentation on them either