From a775ef7b831a2fbcf9c98380367edc16d39c4c6c Mon Sep 17 00:00:00 2001 From: Simon Brooke <simon@journeyman.cc> Date: Wed, 19 Feb 2020 21:18:06 +0000 Subject: [PATCH] WHOOPS! Introduced bugs when I was supposed just to be documenting. --- src/smeagol/configuration.clj | 74 +++++++++++++++++------------------ src/smeagol/formatting.clj | 2 +- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/smeagol/configuration.clj b/src/smeagol/configuration.clj index df42c92..469f338 100644 --- a/src/smeagol/configuration.clj +++ b/src/smeagol/configuration.clj @@ -106,46 +106,46 @@ {:from :smeagol-site-title :to :site-title})) -(defn- build-config +(def build-config "The actual configuration, as a map. The idea here is that the config file is read (if it is specified and present), but that individual values can be overridden by environment variables." - [] - (try - (log/info (str "Reading configuration from " config-file-path)) - (let [file-contents (try - (read-string (slurp config-file-path)) - (catch Exception x - (log/error - (str - "Failed to read configuration from " - config-file-path - " because: " - (type x) - "; " - (.getMessage x))) - {})) - config (merge - file-contents - (transform-map - (from-env-vars - :smeagol-content-dir - :smeagol-default-locale - :smeagol-formatters - :smeagol-js-from - :smeagol-log-level - :smeagol-passwd - :smeagol-site-title) - config-env-transforms))] - (if (env :dev) - (log/debug - "Loaded configuration\n" - (with-out-str (clojure.pprint/pprint config)))) - config) - (catch Exception any - (log/error any "Could not load configuration") - {}))) + (memoize (fn [] + (try + (log/info (str "Reading configuration from " config-file-path)) + (let [file-contents (try + (read-string (slurp config-file-path)) + (catch Exception x + (log/error + (str + "Failed to read configuration from " + config-file-path + " because: " + (type x) + "; " + (.getMessage x))) + {})) + config (merge + file-contents + (transform-map + (from-env-vars + :smeagol-content-dir + :smeagol-default-locale + :smeagol-formatters + :smeagol-js-from + :smeagol-log-level + :smeagol-passwd + :smeagol-site-title) + config-env-transforms))] + (if (env :dev) + (log/debug + "Loaded configuration\n" + (with-out-str (clojure.pprint/pprint config)))) + config) + (catch Exception any + (log/error any "Could not load configuration") + {}))))) (def config "The actual configuration, as a map." - (memoize build-config)) + (build-config)) diff --git a/src/smeagol/formatting.clj b/src/smeagol/formatting.clj index 2166aa1..8f0d92b 100644 --- a/src/smeagol/formatting.clj +++ b/src/smeagol/formatting.clj @@ -48,7 +48,7 @@ (declare process-text) -(defn- process-backticks +(defn process-backticks "Effectively, escape the backticks surrounding this `text`, by protecting them from the `process-text` filter.