Skip to content
Permalink
526cdc58d6
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
86 lines (60 sloc) 2.89 KB
(ns overseer.system-config
(:require [overseer.config :as config]))
(defn test-array
[t]
(let [check (type (t []))]
(fn [arg] (instance? check arg))))
(def byte-array?
(test-array byte-array))
(defn decode-bytes-message
[maybe-bytes]
(if (byte-array? maybe-bytes)
(String. maybe-bytes "UTF-8")
maybe-bytes))
(def dispatcher-request-transducer
(comp
(map decode-bytes-message)
;;(map (fn [x] (do (println "drt received: " (pr-str x)) x)))
;;(map enc/read-edn)
))
(def hostname (.getCanonicalHostName (java.net.InetAddress/getLocalHost)))
(def overseer-session (System/getenv "OVERSEER_SESSION"))
(def overseer-environment (config/get-in [:overseer :environment]))
(def overseer-rx-context (config/get-in [:overseer :rx :context]))
(def overseer-rx-address (config/get-in [:overseer :rx :address]))
(def overseer-rx-superuser-address (config/get-in [:overseer :rx :superuser :address]))
(def rx-config-superuser-base {:listen-context-config (select-keys overseer-rx-context [:username :password])
:listen-address overseer-rx-superuser-address})
(def rx-config-base {:listen-context-config (select-keys overseer-rx-context [:username :password])
:listen-address overseer-rx-address})
(def rx-servers (map vector (:host overseer-rx-context)
(:port overseer-rx-context)))
(def overseer-tx-context (config/get-in [:overseer :tx :context]))
(def overseer-tx-address (config/get-in [:overseer :tx :address]))
(def tx-config-base {:listen-context-config (select-keys overseer-tx-context [:username :password])
:listen-address overseer-tx-address})
(def tx-servers (map vector (:host overseer-tx-context)
(:port overseer-tx-context)))
(def overseer-config
{:listen-selector (str "origin <> '" overseer-session "'")
:dispatcher-request-buffer-size 16
:stop-message (pr-str [:stop])})
(defn build-x-config
[context context-key accumulator item]
(conj accumulator (update context context-key merge {:host (first item)
:port (second item)})))
;;(def overseer-config
;; {:response-context overseer-tx-context
;; :response-address overseer-tx-address
;; :environment overseer-environment})
;;(def endpoints-superuser-config
;; {:response-context overseer-tx-context
;; :response-address overseer-tx-address})
;;(def overseer-superuser-dispatcher-config (assoc overseer-dispatcher-config
;; :listen-address overseer-rx-superuser-address))
;;(def endpoints-user-config
;; {:response-context overseer-tx-context
;; :response-address overseer-tx-address
;; :environment overseer-environment})
;;(def overseer-user-dispatcher-config (assoc overseer-dispatcher-config
;; :listen-address overseer-rx-address))