summaryrefslogtreecommitdiff
path: root/src/utils.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.clj')
-rwxr-xr-xsrc/utils.clj5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils.clj b/src/utils.clj
index 9008793..607343e 100755
--- a/src/utils.clj
+++ b/src/utils.clj
@@ -40,6 +40,11 @@
(slurp* url)
(throw (Exception. (str "Invalid url " u))))))
+(defn get-ip [request]
+ (let [ip (get (:headers request) "x-real-ip") ; behind nginx
+ ip (if ip ip (:remote-addr request))] (str ip)) ; deployed locally
+)
+
(defn append [& vecs]
(reduce into vecs))