boot

:boot-clj: https://boot-clj.github.io/ — build tooling for Clojure. Dev chat in #boot-dev
Ajay 2019-03-08T08:35:16.029900Z

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?

2019-03-08T08:54:18.030900Z

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

Ajay 2019-03-08T09:49:10.032300Z

... 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

2019-03-08T10:10:15.033900Z

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.

Ajay 2019-03-08T10:55:30.035Z

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

2019-03-08T11:47:27.035800Z

Oh I misread your question, I thought you were talking about build.boot, not profile.boot

2019-03-08T11:48:16.036200Z

but where is your configuration meant to be used in the end?

flyboarder 2019-03-08T16:01:46.039600Z

@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

flyboarder 2019-03-08T16:02:51.040600Z

The settings in profile.boot are not exposed to the projects, so you will need to write your own code to read them

flyboarder 2019-03-08T16:03:09.041300Z

Or you can use the bootstrap project which I mentioned previously

flyboarder 2019-03-08T16:27:37.042300Z

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)))