Fork me on GitHub
#luminus
<
2017-08-18
>
mokr12:08:15

I seem to struggle with config not being loaded, or being loaded too late in a Luminus based project. The base template includes the cprop and mount libraries, and defines a component for config. I launch my app with "java -Dconf=prod-config.edn -jar someproject.jar", but for some reason, a DB URL defined in this config.edn, is empty when I try to access it in a route handler (in a namespace that requires the config namespace and refers "env". I'm a bit confused right now, so any tips would be appreciated.

mokr13:08:58

Not sure why, but now it suddenly works. I just hope it's not a race-condition involved that at the moment tips the right way.

yogthos14:08:15

there shouldn't be any race condition as long as you're using defstate to define any resources that depend on the config

yogthos14:08:37

mount resolves the states based on the namespace hierarchy. So, if your db connection is defined using defstate and it uses the env state, mount will guarantee that env is loaded before the connection