From 2e73f899f524d24bcdf95f35a68483a61167512d Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Sat, 9 Jun 2012 21:43:48 +0200 Subject: [PATCH] settings file check-in; db-url will be read out from shell variable --- .gitignore | 1 - settings | 2 ++ src/NoteHub/settings.clj | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 settings diff --git a/.gitignore b/.gitignore index 1d39037..8addd76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -config dump.rdb resources/ pom.xml diff --git a/settings b/settings new file mode 100644 index 0000000..754f1b3 --- /dev/null +++ b/settings @@ -0,0 +1,2 @@ +page-width = 800px +max-title-length = 80 diff --git a/src/NoteHub/settings.clj b/src/NoteHub/settings.clj index 734f12a..74ea8fe 100644 --- a/src/NoteHub/settings.clj +++ b/src/NoteHub/settings.clj @@ -12,7 +12,13 @@ lines (cs/split file-content #"\n") pairs (map #(map cs/trim %) (map #(cs/split % #"=") lines)) config-map (apply hash-map (mapcat #(list (keyword (first %)) (second %)) pairs)) - value (config-map key)] + value (config-map key) + ; Through this hack we can read security-critical settings from (previously + ; set) shell variables without commiting their content to CVS + value (if-not value + (System/getenv + (cs/upper-case + (cs/replace (name key) #"-" ""))))] (if value (if (fn? converter) (converter value) value) default)))