<commit_before>(ns aspire.conf
  (:require [aspire.util :as a-util]
            [clojure.edn :as edn])
  (:import [java.io File]))

(def confdir "/etc/aspire/")

;; The --long-opt for each conf file must match the :conf-key.
(def configs {:conf-sql-db
              {:file "conf-sql-db.edn"
               :opts ["-s" "--conf-sql-db"]}})

(defn confpath-default [configs conf-key]
  (str confdir "/" (:file (configs conf-key))))

(defn conf-opts
  "Pull out the clojure.tools.cli friendly opts for CLI parsing."
  [configs]
  (for [conf-key (keys configs)]
    (concat
     (:opts (configs conf-key))
     ["Specify an alternate config file (.edn format)"
      :default (confpath-default configs conf-key)])))

(defn ensureconf
  "Take in a config-key and an optional location override from the command line.<commit_msg>Add new conf-web.edn conf file handling.<commit_after>(ns aspire.conf
  (:require [aspire.util :as a-util]
            [clojure.edn :as edn])
  (:import [java.io File]))

(def confdir "/etc/aspire")

;; The --long-opt for each conf file must match the :conf-key.
(def configs {:conf-sql-db
              {:file "conf-sql-db.edn"
               :opts ["-s" "--conf-sql-db"]}
              :conf-web
              {:file "conf-web.edn"
               :opts ["-w" "--conf-web"]}})

(defn confpath-default [configs conf-key]
  (str confdir "/" (:file (configs conf-key))))

(defn conf-opts
  "Pull out the clojure.tools.cli friendly opts for CLI parsing."
  [configs]
  (for [conf-key (keys configs)]
    (concat
     (:opts (configs conf-key))
     ["Specify an alternate config file (.edn format)"
      :default (confpath-default configs conf-key)])))

(defn ensureconf
  "Take in a config-key and an optional location override from the command line.
{'fraction_non_alphanumeric': 0.15254237288135594, 'fraction_numerical': 0.0, 'mean_word_length': 2.705020920502092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6779692', 'n_tokens_mistral': 614, 'n_tokens_neox': 595, 'n_words': 186}