-
-
Save emidln/005fa93f70744cc5fe5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns curiosity.analytics.web.settings | |
(:require [schema.core :as s] | |
[schema-contrib.core :as sc] | |
[plumbing.core :refer [map-vals]])) | |
;; This is used to resolve environment variable names | |
;; (and java properties) with minimal conflicts. | |
(def project-name "analytics") | |
;; Settings will get resolved in the following | |
;; order (first one wins) after prepending project-name: | |
;; | |
;; java property (dashes to periods) | |
;; environment variables (dashes to underscores, toUpper everything) | |
;; defaults | |
;; nil | |
;; | |
;; For example `debug` translates to :debug which looks up | |
;; | |
;; java property: notify.debug | |
;; environ variable: NOTIFY_DEBUG | |
;; default value :debug value | |
;; nil | |
(def settings | |
"Map of setting name to a map containing :schema and :default" | |
{:debug {:schema s/Bool :default false} | |
:db-uri {:schema sc/URI :default "postgres://localhost:5432/userevents"} | |
:redis-uri {:schema sc/URI :default "redis://localhost:6379/0"} | |
:nrepl-port {:schema s/Int :default 7234} | |
:http-ip {:schema s/Str :default "127.0.0.1"} | |
:http-port {:schema s/Int :default 8080} | |
:sentry-dsn {:schema (s/maybe s/Str) :default nil} | |
:curiosity-environment {:schema s/Str :default "dev"}}) | |
;; Our system initialization wants maps of the settings-schema | |
;; as well as the settings-defaults for processing in stages. | |
(def settings-schema (map-vals :schema settings)) | |
(def settings-defaults (map-vals :default settings)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment