(directive? form)
checks if a form is a directive
(directive? "hello") => false
(directive? [:eval '(+ 1 2 3)]) => true
checks if a form is a directive (directive? "hello") => false (directive? [:eval '(+ 1 2 3)]) => true
(ex-config msg)
(ex-config msg data)
(ex-config msg data e)
helper function for creating config exceptions
(ex-config "error" {})
helper function for creating config exceptions (ex-config "error" {})
(load)
(load file)
helper function for file resolvers
(load "dev/test/hara.config/config.edn") => map?
helper function for file resolvers (load "dev/test/hara.config/config.edn") => map?
(prewalk f form)
modified clojure.walk/prewalk function for config
modified clojure.walk/prewalk function for config
(resolve form)
helper function for resolve
(resolve 1) => 1
(resolve [:str ["hello" " " "there"]]) => "hello there"
helper function for resolve (resolve 1) => 1 (resolve [:str ["hello" " " "there"]]) => "hello there"
(resolve-content
content
{:keys [secured key default format type] :as opts :or {type :text}})
resolves directive into content
(resolve-content "hello" {}) => "hello"
(resolve-content "hello" {:type :edn}) => 'hello
(resolve-content "yzRQQ+R5tWYeg7DNp9wvvA==" {:type :edn :secured true :key "Bz6i3dhp912F8+P82v1tvA=="}) => {:a 1, :b 2}
resolves directive into content (resolve-content "hello" {}) => "hello" (resolve-content "hello" {:type :edn}) => 'hello (resolve-content "yzRQQ+R5tWYeg7DNp9wvvA==" {:type :edn :secured true :key "Bz6i3dhp912F8+P82v1tvA=="}) => {:a 1, :b 2}
(resolve-directive form)
resolves directives with error handling
(resolve-directive [:merge {:a 1} {:b 2}]) => {:a 1, :b 2}
resolves directives with error handling (resolve-directive [:merge {:a 1} {:b 2}]) => {:a 1, :b 2}
(resolve-directive-case [_ sel & pairs])
switches from the selected element
(System/setProperty "hara.config.profile" "dev")
(resolve-directive-case [:case [:properties "hara.config.profile"] "public" "public-profile" "dev" "dev-profile"]) => "dev-profile"
switches from the selected element (System/setProperty "hara.config.profile" "dev") (resolve-directive-case [:case [:properties "hara.config.profile"] "public" "public-profile" "dev" "dev-profile"]) => "dev-profile"
(resolve-directive-env [_ env opts])
reads from system env
(resolve-directive-env [:env "HOME"]) ;; "/Users/chris" => string?
reads from system env (resolve-directive-env [:env "HOME"]) ;; "/Users/chris" => string?
(resolve-directive-error [_ msg error])
throws an error with message
(resolve-directive-error [:error "errored" {}]) => throws
throws an error with message (resolve-directive-error [:error "errored" {}]) => throws
(resolve-directive-eval [_ form])
evaluates a config form
(System/setProperty "hara.config.items" "3")
(resolve-directive-eval [:eval '(+ 1 2 [:properties "hara.config.items" {:type :edn}])]) => 6
evaluates a config form (System/setProperty "hara.config.items" "3") (resolve-directive-eval [:eval '(+ 1 2 [:properties "hara.config.items" {:type :edn}])]) => 6
(resolve-directive-file [_ path opts])
resolves to file content
(resolve-directive-file [:file "dev/test/hara.config/hello.clear"]) => "hello"
resolves to file content (resolve-directive-file [:file "dev/test/hara.config/hello.clear"]) => "hello"
(resolve-directive-format [_ args opts])
formats values to form a string
(resolve-directive-format [:format ["http://%s:%s" "localhost" "8080"]]) => "http://localhost:8080"
formats values to form a string (resolve-directive-format [:format ["http://%s:%s" "localhost" "8080"]]) => "http://localhost:8080"
(resolve-directive-global [_ val opts])
resolves a directive form the global map
(resolve-directive-global [:global :user.name]) => string?
resolves a directive form the global map (resolve-directive-global [:global :user.name]) => string?
(resolve-directive-include [_ path opts])
resolves to either current project or config directory
(resolve-directive-include [:include "dev/test/hara.config/hello.clear" {:type :edn}]) => 'hello
resolves to either current project or config directory (resolve-directive-include [:include "dev/test/hara.config/hello.clear" {:type :edn}]) => 'hello
(resolve-directive-merge [_ & args])
merges two entries together
(resolve-directive-merge [:merge {:a {:b 1}} {:a {:c 2}}]) => {:a {:c 2}}
merges two entries together (resolve-directive-merge [:merge {:a {:b 1}} {:a {:c 2}}]) => {:a {:c 2}}
(resolve-directive-or [_ & args])
reads from the first non-nil value
(resolve-directive-or [:or [:env "SERVER"] "<server>"]) => "<server>"
reads from the first non-nil value (resolve-directive-or [:or [:env "SERVER"] "<server>"]) => "<server>"
(resolve-directive-parent [_ val opts])
resolves a directive from the map parent
(binding [current [{:a {:b [:eval "hello"]}} {:b [:eval "hello"]}]] (resolve-directive-parent [:parent :b])) => "hello"
resolves a directive from the map parent (binding [*current* [{:a {:b [:eval "hello"]}} {:b [:eval "hello"]}]] (resolve-directive-parent [:parent :b])) => "hello"
(resolve-directive-project [_ proj opts])
reads form the project
(resolve-directive-project [:project :name] ) => 'hara
reads form the project (resolve-directive-project [:project :name] ) => 'hara
(resolve-directive-properties [_ property opts])
reads from system properties
(resolve-directive-properties [:properties "user.name"]) ;; "chris" => string?
reads from system properties (resolve-directive-properties [:properties "user.name"]) ;; "chris" => string?
(resolve-directive-resource [_ path opts])
resolves to resource content
(resolve-directive-resource [:resource "dev/test/hara.config/hello.clear"]) => "hello"
resolves to resource content (resolve-directive-resource [:resource "dev/test/hara.config/hello.clear"]) => "hello"
(resolve-directive-root [_ val opts])
resolves a directive from the config root
(binding [current [{:a {:b [:eval "hello"]}}]] (resolve-directive-root [:root [:a :b]])) => "hello"
resolves a directive from the config root (binding [*current* [{:a {:b [:eval "hello"]}}]] (resolve-directive-root [:root [:a :b]])) => "hello"
(resolve-directive-str [_ args opts])
joins values to form a string
(resolve-directive-str [:str ["hello" [:env "SPACE" {:default " "}] "world"]]) => "hello world"
joins values to form a string (resolve-directive-str [:str ["hello" [:env "SPACE" {:default " "}] "world"]]) => "hello world"
(resolve-map input form)
resolves a map
(resolve-map {:a {:b [:eval "hello"]}} [:a :b]) => "hello"
resolves a map (resolve-map {:a {:b [:eval "hello"]}} [:a :b]) => "hello"
(resolve-path path)
helper function for file resolvers
(resolve-path ["config/" [:eval "hello"]]) => "config/hello"
helper function for file resolvers (resolve-path ["config/" [:eval "hello"]]) => "config/hello"
(resolve-type type content)
converts a string to a type
(resolve-type :text "3") => "3"
(resolve-type :edn "3") => 3
converts a string to a type (resolve-type :text "3") => "3" (resolve-type :edn "3") => 3
(walk inner outer form)
modified clojure.walk/walk function for config
modified clojure.walk/walk function for config
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close