-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty files cause issues while loading #53
Comments
@tolitius Hi :) Is that a bug or a feature ? I encountered a similar use case while using cprop (and same workaround). The fix would be to change (if-let [config (cond (map? config) config (nil? config) {} :else nil)]) (This is an idea, not the final shape of the code) |
I think that would work fine. I'm not sure why the code doesn't read |
Because of |
Ah, ok. I hadn't dug into the code, but that makes sense. |
debatable :)
the second one occurs more often, hence the behavior |
So is a change warranted, or do I just need to be aware of this behavior and work around it? |
Just ran into this. The design choice of assuming that load-config is the one and only entry point seems limiting to me. @tolitius, I like what you did here with providing structure to env vars. So sometimes I might not want to load a config file but still want to use In terms of 12-factor, it's foreseeable that on dev you'd use For sake of composability, why not raise |
FYI I'm doing this to enable (try
(load-config :merge [(from-system-props) (from-env)])
(catch RuntimeException ex
;; https://github.com/tolitius/cprop/issues/53#issuecomment-912153331
(if (re-seq #"non empty configuration file" (.getMessage ex))
(from-env)
(throw ex)))) |
When using
cprop
as part of theluminus
framework, there is a config.edn for each environment: dev, test, and prod. The files generated byluminus
are mostly empty, and the developer can add settings if needed.When pushing to prod on Heroku, however, these empty files cause a problem. We get an error saying a non-empty config file was not found. The file is present, but has an empty map
{}
. The workaround is to put a redundant or meaningless value in the map, but it seems the system should handle an empty map.The text was updated successfully, but these errors were encountered: