Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slightly better config #16

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions resources/config.edn
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
{:alfresco {:scheme "http"
:host "localhost"
:port 8080
:core-path "alfresco/api/-default-/public/alfresco/versions/1"
:search-path "alfresco/api/-default-/public/search/versions/1"
:auth-path "alfresco/api/-default-/public/authentication/versions/1"
:discovery-path "alfresco/api/discovery"
:user "admin"
:password "admin"}
:activemq {:scheme "tcp"
:host "localhost"
:port 61616
:topic "alfresco.repo.event2"}}
{:alfresco {:scheme "http"
:port 8080}}
27 changes: 25 additions & 2 deletions src/weller/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns weller.config)
(ns weller.config
(:require [immuconf.config :as immu]
[taoensso.telemere :as t]))

(def config (atom {}))
(def config (atom {:alfresco {:scheme "http"
:host "localhost"
:port 8080
:core-path "alfresco/api/-default-/public/alfresco/versions/1"
:search-path "alfresco/api/-default-/public/search/versions/1"
:auth-path "alfresco/api/-default-/public/authentication/versions/1"
:discovery-path "alfresco/api/discovery"
:user "admin"
:password "admin"}
:activemq {:scheme "tcp"
:host "localhost"
:port 61616
:topic "alfresco.repo.event2"}}))

(defn configure
[]
(try
(let [cfg (immu/load "resources/config.edn")]
(swap! config assoc :alfresco (merge (:alfresco @config) (:alfresco cfg)))
(swap! config assoc :activemq (merge (:activemq @config) (:activemq cfg))))
(catch Exception e (t/log! :error (.getMessage e))))
(t/log! :debug @config))
10 changes: 2 additions & 8 deletions src/weller/event_handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@

(defn make-handler
([]
;; load config
(try
(let [config (immu/load "resources/config.edn")]
(swap! c/config assoc :activemq (:activemq config))
(swap! c/config assoc :alfresco (:alfresco config)))
(catch Exception e (t/log! :error (.getMessage e))))
(t/log! :debug @c/config)

;; load configuration
(c/configure)
(let [chan (a/chan)]
(map->EventHandler {:listener (activemq/make-listener (:activemq @c/config) chan)
:taps []
Expand Down