From 44703d58892e698ffacb01ed18c970c4c17dfdcb Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 9 Sep 2017 11:42:09 +0100 Subject: [PATCH] Optional environment variable for passwd file. --- src/smeagol/authenticate.clj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/smeagol/authenticate.clj b/src/smeagol/authenticate.clj index f6dd300..cfc3045 100644 --- a/src/smeagol/authenticate.clj +++ b/src/smeagol/authenticate.clj @@ -1,9 +1,10 @@ (ns ^{:doc "Authentication functions." :author "Simon Brooke"} smeagol.authenticate - (:require [taoensso.timbre :as timbre] + (:require [crypto.password.scrypt :as password] + [environ.core :refer [env]] [noir.io :as io] - [crypto.password.scrypt :as password])) + [taoensso.timbre :as timbre])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; @@ -34,8 +35,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; the relative path to the password file. -;; (def password-file-path (str (io/resource-path) "../passwd")) -(def password-file-path (str (clojure.java.io/resource "passwd"))) +(def password-file-path + (or + (env :smeagol-passwd) + (str (clojure.java.io/resource "passwd")))) + (defn- get-users "Get the whole content of the password file as a clojure map"