This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-29
Channels
- # announcements (6)
- # babashka (7)
- # beginners (24)
- # calva (2)
- # cider (21)
- # clj-kondo (49)
- # cljdoc (29)
- # clojure (56)
- # clojure-dev (2)
- # clojure-europe (15)
- # clojure-nl (6)
- # clojure-norway (27)
- # clojure-uk (3)
- # clojuredesign-podcast (6)
- # clojurescript (1)
- # conjure (1)
- # core-async (8)
- # cryogen (2)
- # cursive (6)
- # data-science (1)
- # datomic (12)
- # events (1)
- # fulcro (16)
- # graalvm (28)
- # hyperfiddle (2)
- # lambdaisland (4)
- # leiningen (20)
- # observability (1)
- # off-topic (24)
- # pathom (5)
- # pedestal (10)
- # portal (7)
- # practicalli (1)
- # reitit (5)
- # rewrite-clj (20)
- # shadow-cljs (18)
- # vim (8)
- # xtdb (9)
Does anyone know how to ensure a resources/config.edn file (or any config file) is only loaded at runtime for GraalVM Native image?
in the code, i’m doing this:
(def read-config
(-> "resources/config.edn"
(slurp)
(edn/read-string)))
but can’t really find it, as this line
(let [bb-edn-resource (fs/file bb-edn-dir "META-INF" "bb.edn")]
https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Resources/
read those docs + don't cause any side effects on the top level, they will be executed during image build. Do it in a function
unless you want to cause the side effect to be executed during image build of course
yeah i have found that Accessing Resources link, but couldn’t figure out how to use it:sweat_smile:
check out how clj-kondo does it, it includes the entire resources/clj_kondo/impl
directory inside the binary
Awesome, wrapping it in an fn did the trick easily
(def read-config
(fn []
(-> "resources/config.edn"
(slurp)
(edn/read-string))))