Skip to content

Instantly share code, notes, and snippets.

@bbbates
Last active January 1, 2016 15:59
Show Gist options
  • Save bbbates/8167455 to your computer and use it in GitHub Desktop.
Save bbbates/8167455 to your computer and use it in GitHub Desktop.
Simple map-based clojure configuration
(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