Can someone give me a code sample of how to keep configuration in ./profile.boot, and then read in Clojure source code? Let's say I want to keep 'some.url=http://google.com' in configuration, 1. How do I set it in profile.boot? 2. How do I read it in Clojure source file?
it doesn’t have to be boot-specific. Now if you want to pass it as arguments you can do something like for the port there: https://github.com/Deraen/saapas/blob/master/build.boot#L87
... I am looking for profile.boot specifically, I do not want to accept it as command line argument ... so specific two steps that I mentioned
profile.boot
contains clojure code - so you can read your config there. And then if you can pass a port to your app, nothing prevents you from passing your whole config.
this document says profile.boot is to set config not read - https://github.com/boot-clj/boot/wiki/Configuring-Boot#configuring-your-clojure-project, without a sample code these things are not clear to me
Oh I misread your question, I thought you were talking about build.boot, not profile.boot
but where is your configuration meant to be used in the end?
@ajay.rivendell while there is nothing preventing you from using the profile.boot file for configuration of your project that’s not what it is designed for and I recommend keeping your configuration somewhere else, like an EDN file somewhere in the project
The settings in profile.boot are not exposed to the projects, so you will need to write your own code to read them
Or you can use the bootstrap project which I mentioned previously
The code which you are looking for is probably something like this:
(defn read-file [file] (read-string (slurp file)))
(defn shadow-cljs-edn [] (read-file "./shadow-cljs.edn"))
(defn get-deps [] (:dependencies (shadow-cljs-edn)))