get config and is_tech working

This commit is contained in:
Travis Shears 2025-07-16 20:50:02 +02:00
parent 77ae02c8b8
commit 8e0d00035a
5 changed files with 109 additions and 0 deletions

26
src/micro_blog/config.clj Normal file
View file

@ -0,0 +1,26 @@
(ns micro-blog.config
(:require [environ.core :refer [env]]))
(def ^:private env-overrides
{:minstral-api-key "MISTRAL_API_KEY"})
(defn- load-config []
(println "config is being loaded")
(merge (read-string (slurp "config.edn"))
(into {} (for [[k env-var] env-overrides
:let [env-val (env env-var)]
:when env-val]
[k env-val]))))
(def config (atom (load-config)))
(defn reload-config []
(reset! config (load-config)))
(comment
;; Example usage:
;; Access the config
@config
;; Reload the config at runtime
(reload-config))