Skip to content

Commit

Permalink
facility
Browse files Browse the repository at this point in the history
  • Loading branch information
wactbprot committed Aug 9, 2021
1 parent 9811ce0 commit 7e68200
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ENVIRONMENT-VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@
* Valid values: `9009`, `55555`, ...
* Set Example: `export DEVHUB_IP=55555`
* Default value: `9009`

## `"DEVHUB_FACILITY"`

* Valid values: any string
* Set Example: `export DEVHUB_FACILITY="SE3"`
* Default value: none
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/conf.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{:log-context {:app-name "devhub"}
:mulog {:type :multi
;; send events to the stdout
:console {:type :console
Expand Down
7 changes: 6 additions & 1 deletion src/devhub/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
[:mulog :publishers]
(if (= e :off) [] [(get-in conf [:mulog e] d)]))))

(defn log-context [ conf]
(if-let [s (System/getenv "DEVHUB_FACILITY")]
(assoc-in conf [:log-context :facility] s)
conf))

(defn ip [conf]
(if-let [e (System/getenv "DEVHUB_IP")]
(assoc-in conf [:server :ip] e)
Expand All @@ -36,4 +41,4 @@

(defn stub-mode [conf] (get-in conf [:stub :mode]))

(defn config [] (-> (get-conf) log-type ip port ))
(defn config [] (-> (get-conf) log-type log-context ip port ))
8 changes: 4 additions & 4 deletions src/devhub/server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(:require [compojure.route :as route]
[devhub.config :as c]
[devhub.utils :as u]
[clojure.pprint :as pprint]
[devhub.pp :as pp]
[devhub.pp-js :as js]
[devhub.pp-py :as py]
Expand Down Expand Up @@ -132,9 +133,8 @@
middleware/wrap-json-response))

(defn init-log!
[{conf :mulog }]
(mu/set-global-context!
{:app-name "devhub" :version (:version (u/version))})
[{conf :mulog ctx :log-context}]
(mu/set-global-context! ctx)
(mu/start-publisher! conf))

(def server (atom nil))
Expand All @@ -157,6 +157,6 @@
(reset! server (run-server #'app (:server conf)))))

(defn -main [& args]
(println (c/config))
(pprint/pprint (c/config))
(u/ascii-logo)
(start))

0 comments on commit 7e68200

Please sign in to comment.