Skip to content

Commit

Permalink
chore: Load system-wide user.clj when REPL starts (metabase#46514)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev authored Aug 6, 2024
1 parent 9759487 commit 5ed7d78
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dev/src/user.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
[metabase.plugins.classloader :as classloader]
[metabase.util :as u]))

;; Load all user.clj files (including the system-wide one).
(when *file* ; Ensure we don't load ourselves recursively, just in case.
(->> (.getResources (.getContextClassLoader (Thread/currentThread)) "user.clj")
enumeration-seq
rest ; First file in the enumeration will be this file, so skip it.
(run! #(do (println "Loading" (str %))
(clojure.lang.Compiler/load (clojure.java.io/reader %))))))

;; Wrap these with ignore-exceptions to reduce the "required" deps of this namespace
;; We sometimes need to run cmd stuffs like `clojure -M:migrate rollback n 3` and these
;; libraries might not be available in the classpath
Expand Down

0 comments on commit 5ed7d78

Please sign in to comment.