Skip to content

Commit

Permalink
Implement getting credentials from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
profitware committed Mar 11, 2018
1 parent a899032 commit 1bf08f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions flower-common/resources/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{:account {}
:token {}
:url {}}
12 changes: 10 additions & 2 deletions flower-common/src/flower/credentials.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(ns flower.credentials
(:require [cprop.core :as cprop]))
(:require [clojure.java.io :as io]
[cprop.core :as cprop]
[cprop.source]))


;;
Expand All @@ -16,5 +18,11 @@
;;

(defn get-credentials [& path]
(get-in (cprop/load-config :file *credentials-file*)
(get-in (if (.exists (io/as-file *credentials-file*))
(cprop/load-config :file *credentials-file*)
(cprop/load-config :merge [{:account {}
:token {}
:url {}}
(select-keys (cprop.source/from-env)
[:account :token :url])]))
path))

0 comments on commit 1bf08f0

Please sign in to comment.