Fork me on GitHub
#babashka
<
2022-03-10
>
mknoszlig14:03:13

would it make sense to have a property babashka.config that contains the location of the active bb.edn ? I could use this right now to locate resources relative to bb.edn when calling from some other place using --config - so kind of like babashka.file but for tasks?

borkdude16:03:50

For your use case it may not be necessary, as the classpath is set according to the config

borkdude16:03:04

So if you use io/resource it will automatically work alright

mknoszlig20:03:18

that’s a good point, thanks! 🙂

mknoszlig20:03:07

but i’ve noticed that neither *file* nor babashka.file seem to be helpful in the task context, so maybe it’s worth considering nevertheless (although i realize babashka.task is available to detect whether we’re in task)

borkdude20:03:46

We can still add this, no problem. Issue + PR welcome

mknoszlig20:03:11

would you prefer to have the bb.edn location accessible via babashka.file?

mknoszlig20:03:24

or a separate property?

borkdude20:03:59

hmm, interesting, yeah let's do a separate property

borkdude20:03:07

babashka.config

borkdude20:03:37

Or maybe a function in babashka.tasks?

borkdude20:03:33

or maybe one in babashka.core

borkdude20:03:58

The benefit of a function would be that you don't have to set the property when nobody uses it

mknoszlig20:03:47

hmm, isn’t the same true for babashka.file ?

mknoszlig20:03:24

fwiw i would be less surprised to find that info in a property, it seems consistent with what’s already there

borkdude20:03:21

yes, the same is true for babashka.file but this was a progressive insight. the least amount of work we have to do at startup, the better

borkdude20:03:33

but yeah, now there's maybe no way back

borkdude21:03:32

so let's go forward with the system property

borkdude21:03:24

I guess we can spare 2/100th of a ms of startup time ;)

user=> (time (System/setProperty "babashka.config" "foo.bar"))
"Elapsed time: 0.024758 msecs"

mknoszlig21:03:15

lol, hopefully :)

borkdude17:03:40

:D Hello from M1

docker run --rm babashka/babashka bb -e '(System/getProperty "os.arch")'
"aarch64"

🎉 16
sheepy 4