Skip to content

dpassen/malapropism

Repository files navigation

malapropism

test lint check editorconfig downloads

An omniconf inspired config library using malli

Latest version

malapropism is deployed to Clojars

Clojars Project

Rationale

Configuration is one of the peripheries of our systems. It's a good place to ensure correctness. Enter malli, a library that I've really grown to appreciate.

Configuration should be flexible. Most solutions in this space assume too much.

With malapropism,

  • Stick it in an atom? Yeah!
  • Put it in a delay? Okay
  • Keep it behind core.cache or core.memoize? Sure, why not?
  • Deliver it to a promise? I could see it
  • Re-compute it each and every time? I wouldn’t
  • Have a single configuration? Yeah, that makes sense
  • Have more than one? No one's going to stop you

Usage

(require '[org.passen.malapropism.core :as malapropism])

(def config-schema
  [:map
   [:env-key :keyword]
   [:scm-rev :string]
   [:port :int]
   [:prefix
    {:default "/api"}
    :string]])

(-> (malapropism/with-schema config-schema)
    (malapropism/with-values-from-env)
    (malapropism/with-values-from-system)
    (malapropism/with-values-from-map
      {:env-key :dev
       :scm-rev "923345"
       :port    8080
       :prefix  "/web"})
    (malapropism/verify! :verbose? true))

Consumers

These companies use malapropism. Feel free to add your company to the list.

License

Copyright © 2022-2023 Derek Passen

Released under an MIT license.

About

Malli-backed configuration library

Resources

License

Stars

Watchers

Forks

Packages

No packages published