std.config.resolve
directive?
added in 3.0
(directive? form)ex-config
added in 3.0
(ex-config msg)(ex-config msg data)(ex-config msg data e)helper function for creating config exceptions
(ex-config “error” {})
load
added in 3.0
(load)(load file)helper function for file resolvers
(load “test-data/std.config/config.edn”) => map?
resolve
added in 3.0
(resolve form)(resolve form key)resolve-content
added in 3.0
(resolve-content content {:keys [secured key default format type select], :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}
resolve-directive
added in 3.0
(resolve-directive form)resolves directives with error handling
(resolve-directive :merge {:a 1} {:b 2}) => {:a 1, :b 2}
resolve-directive-case
added in 3.0
(resolve-directive-case [_ sel & pairs])switches from the selected element
(System/setProperty “std.config.profile” “dev”)
(resolve-directive-case [:case :properties “std.config.profile” “public” “public-profile” “dev” “dev-profile”]) => “dev-profile”
resolve-directive-env
added in 3.0
(resolve-directive-env [_ env opts])reads from system env
(resolve-directive-env :env “HOME”) ;; “/Users/chris” => string?
resolve-directive-error
added in 3.0
(resolve-directive-error [_ msg error])throws an error with message
(resolve-directive-error :error “errored” {}) => (throws)
resolve-directive-eval
added in 3.0
(resolve-directive-eval [_ form])evaluates a config form
(System/setProperty “std.config.items” “3”)
(resolve-directive-eval [:eval ’(+ 1 2 :properties “std.config.items” {:type :edn})]) => 6
resolve-directive-file
added in 3.0
(resolve-directive-file [_ path opts])resolves to file content
(resolve-directive-file :file “test-data/std.config/hello.clear”) => “hello”
resolve-directive-format
added in 3.0
(resolve-directive-format [_ args opts])formats values to form a string
(resolve-directive-format [:format “http://%s:%s” “localhost” “8080”]) => “http://localhost:8080”
resolve-directive-global
added in 3.0
(resolve-directive-global [_ val opts])resolves a directive form the global map
(resolve-directive-global :global :user.name) => string?
resolve-directive-include
added in 3.0
(resolve-directive-include [_ path opts])resolves to either current project or config directory
(resolve-directive-include :include “test-data/std.config/hello.clear” {:type :edn}) => ’hello
resolve-directive-merge
added in 3.0
(resolve-directive-merge [_ & args])merges two entries together
(resolve-directive-merge :merge {:a {:b 1}} {:a {:c 2}}) => {:a {:c 2}}
resolve-directive-or
added in 3.0
(resolve-directive-or [_ & args])reads from the first non-nil value
(resolve-directive-or [:or :env “SERVER” “
resolve-directive-parent
added in 3.0
(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”
resolve-directive-project
added in 3.0
(resolve-directive-project [_ proj opts])reads form the project
(resolve-directive-project :project :name) => symbol?
resolve-directive-properties
added in 3.0
(resolve-directive-properties [_ property opts])reads from system properties
(resolve-directive-properties :properties “user.name”) ;; “chris” => string?
resolve-directive-resource
added in 3.0
(resolve-directive-resource [_ path opts])resolves to resource content
(resolve-directive-resource :resource “std.config/hello.clear”) => “hello”
resolve-directive-root
added in 3.0
(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”
resolve-directive-str
added in 3.0
(resolve-directive-str [_ args opts])joins values to form a string
(resolve-directive-str [:str [“hello” :env “SPACE” {:default " "} “world”]]) => “hello world”
resolve-map
added in 3.0
(resolve-map input form)resolves a map
(resolve-map {:a {:b :eval “hello”}} :a :b) => “hello”
resolve-path
added in 3.0
(resolve-path path)helper function for file resolvers
(resolve-path [“config/” :eval “hello”]) => “config/hello”
resolve-select
added in 3.0
(resolve-select content {:keys [keys in exclude], :as select})resolve-type
added in 3.0
(resolve-type type content)converts a string to a type
(resolve-type :text “3”) => “3”
(resolve-type :edn “3”) => 3