Last active
January 1, 2016 15:59
-
-
Save bbbates/8167455 to your computer and use it in GitHub Desktop.
Simple map-based clojure configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns app.config) | |
(def local-dev-config | |
{:enable-schedule false | |
:db { | |
:username "local-user" | |
:password "password" | |
}}) | |
(def test-config | |
{:enable-schedule true | |
:db { | |
:host "some-host.db.com" | |
:username "test-user" | |
:password "JEI343klj43ljkA"}}) | |
(defn get-cfg [& kws] | |
;; look for system property value to tell us what map to use, and use get-in to get it for us | |
) | |
;; To get a value somewhere: | |
(init-connection (get-cfg :db :username) (get-cfg :db password) (get-cfg :db host)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment