Clojure Configuration in 2026: Aero vs Environ vs cprop Compared

The config file was fine in development. Then staging needed a different database URL, production needed a password that must never enter git, and the ops team insisted everything be overridable by environment variable. Six months later the config is a 400-line EDN file with #env tags inside #or tags, a profiles.clj nobody dares edit, and a “works on my machine” bug caused by precedence: the system property you set for the JVM silently lost to an environment variable you forgot existed.

Clojure has three mature answers to this, and they represent genuinely different philosophies rather than three implementations of the same idea. Aero treats configuration as a rich EDN document with tag literals. Environ treats configuration as environment variables and almost nothing else, following the twelve-factor pattern. cprop treats configuration as a merge of many sources with a documented precedence order.

Picking wrong is expensive because config libraries are load-bearing: they sit under every namespace, and swapping one later means touching startup code across the whole service.

TL;DR — Quick Verdict

Choose Aero if your configuration is structured EDN — nested maps, profiles, includes, cross-references, and typed values. It is the most expressive of the three, has 13.5M Clojars downloads, and is actively maintained (last push May 2026, version 1.1.6). Choose Environ if you truly follow twelve-factor and want one map of strings — 17.9M downloads, version 1.2.0, dead simple, zero ceremony. Choose cprop if you must merge config files, JVM properties, .env files and environment variables with file-based overrides — 2.7M downloads, version 0.1.21, EPL-1.0.

Blunt recommendation: Aero plus a thin env-var layer covers most Clojure services. Reach for Environ when you want to keep secrets strictly out of files. Reach for cprop when you have inherited a deployment that already uses .properties files and system properties and cannot change that.

Side-by-Side Comparison

DimensionAeroEnvironcprop
Core ideaEDN with tag literalsEnv vars into one mapMulti-source merge
GitHub stars825935369
Last push2026-05-012024-04-152025-10-04
Latest release1.1.61.2.00.1.21
Clojars downloads13,505,16717,926,0512,711,098
LicenseMITEPL (no SPDX detected)EPL-1.0
Nested structureNative EDN mapsFlat keywords onlyNative EDN maps
Typed values#long, #double, #boolean, #keywordStrings onlyEDN types in files, strings from env
Profiles#profile mapprofiles.clj via pluginMerge order + :override-with
File includes#include with resolversNo:merge with from-file
Secrets handling#include a git-ignored fileEnv vars onlyMerge a private file last
Runtime re-readNo (read once)env is a delay-backed mapNo

The download numbers deserve a caveat: Environ’s lead comes from being a transitive dependency of countless Leiningen templates, not necessarily from teams choosing it deliberately. Aero’s 13.5M reflects the same effect through juxt stack templates. Neither number tells you which library is better for your case.

Decision Matrix: Use Case → Tool

Your situationUseWhy
EDN config with nesting and defaultsAero#or [#env PORT 8080] is the whole pattern in one line
Kubernetes deployment, env vars injectedEnvironReads env directly, no file parsing
Legacy .properties + system propertiescpropPrecedence chain is explicit and configurable
Config split across many filesAero#include with resource-resolver for jar-safe loading
Per-host or per-user overridesAero#hostname and #user tags
Multi-tenant with separate configscprop:merge accepts a sequence of maps from any source
Strict twelve-factor disciplineEnvironNo file-based config at all
You need typed values from stringsAero#long, #double, #boolean readers

Aero — Configuration as an EDN Document

Aero’s thesis is written into its README: configuration should be explicit, intentful, obvious, but not clever, and it should be data, not a program. That second point is a security argument — a Turing-complete config language is an attack surface, and Aero deliberately stays on the safe side by extending EDN with a fixed set of tag literals rather than embedding arbitrary evaluation.

1
2
;; deps.edn
{:deps {aero/aero {:mvn/version "1.1.6"}}}

Reading a config is two lines, and the README is emphatic about which form to use:

1
2
3
4
5
6
7
(require '[aero.core :refer [read-config]])

;; Fine in the REPL, but breaks when running from an uberjar:
(read-config "config.edn")

;; Correct in all scenarios — classpath-relative:
(read-config (clojure.java.io/resource "config.edn"))

That warning is the most valuable sentence in the documentation. (read-config "config.edn") works in tests and the REPL because the file is on disk relative to the working directory. Inside an uberjar there is no working directory containing it, and the call fails at startup — in production, not in CI.

The tag literals are where Aero earns its place:

1
2
3
4
5
6
7
8
{:database-uri #env DATABASE_URI
 :port         #or [#env PORT 8080]
 :debug        #boolean #or [#env DEBUG "true"]
 :factories    #long #env FACTORY_COUNT
 :mode         #keyword #env MODE
 :webserver    {:port #profile {:default 8000
                                :dev     8001
                                :test    8002}}}

Read that with a profile:

1
2
(read-config "config.edn" {:profile :dev})
;; => {:webserver {:port 8001} ...}

Three things are happening that matter in production:

  1. #or gives you a default without a second config file. The fallback is inline, so the reader sees both the env var name and the value used when it is unset. No more hunting for a config-defaults.edn.
  2. #profile replaces per-environment file duplication. A single file carries dev, test and prod differences side by side, which is exactly what Aero’s design goals argue for — differences stay visible instead of diverging across files.
  3. Type coercion is explicit. Everything arriving from the environment is a string. #long, #double, #boolean and #keyword convert at read time so the rest of the code receives 8080, not "8080". Skipping this is how you get a port that compares equal to "8080" and fails silently.

For connection strings, #join and #envf avoid string concatenation in code:

1
2
3
4
5
6
{:url #join ["jdbc:postgresql://psq-prod/prod?user="
             #env PROD_USER
             "&password="
             #env PROD_PASSWD]}

 :database #envf ["protocol://%s:%s" DATABASE_HOST DATABASE_NAME]}

And #include splits large configs while keeping secrets out of git:

1
2
3
{:webserver #include "webserver.edn"
 :analytics #include "analytics.edn"
 :secrets   #include "secrets.edn"}   ;; git-ignored

The include resolver is a real deployment detail: by default #include resolves relative to the config file being read, which does not work inside a jar. Pass a resolver for uberjar deployments:

1
2
3
4
(require '[aero.core :refer (read-config resource-resolver)])
(read-config (clojure.java.io/resource "config.edn")
             {:profile :prod
              :resolver resource-resolver})

Aero also supports #ref for cross-references (one database URI shared by two subsystems) and #merge for combining maps. Both reduce duplication, which is the entire point of the library.

Where Aero hurts: there is no runtime reload. read-config returns an immutable map, so changing an environment variable requires a restart. That is correct for most services and painful for long-running REPL-driven workflows where you want to re-read config without restarting the system.

Environ — Twelve-Factor Minimalism

Environ is the opposite bet: configuration lives in the environment, and the library’s job is to present it as one map. Its README states the scope plainly — it works well for applications following the twelve-factor pattern, and it supports four sources resolved in a fixed order: .lein-env, .boot-env, environment variables, and Java system properties.

1
2
3
;; project.clj
:dependencies [[environ "1.2.0"]]
:plugins [[lein-environ "1.2.0"]]

Usage is a single require and a keyword lookup:

1
2
3
4
(require '[environ.core :refer [env]])

(def database-url
  (env :database-url))

That is the whole API surface you need ninety percent of the time. The :database-url keyword maps to DATABASE_URL in the environment — Environ handles the transformation, so Clojure code stays in keyword idiom while deployment stays in shell idiom.

Three practical notes from the source:

  • Values are strings. (env :port) returns "8080". Parse at the boundary with Long/parseLong or a small coercion helper, and do it once at startup rather than at every use site.
  • Missing keys are nil. There is no validation. A typo in an environment variable name produces a nil that surfaces somewhere deep in a connection pool. Add an explicit startup check.
  • The last push was April 2024. Environ is stable, but it is not receiving active development. For a library this small that is acceptable — the env-var contract has not changed — but do not expect new features.

Environ pairs naturally with Aero: use #env tags for the handful of values that must come from the environment, and keep the rest of the structure in EDN. Where Environ wins outright is the case where the config file itself is a liability — a container platform that injects everything, an auditor who does not want secrets on disk, or a team that has been burned by a committed config.edn containing a production password.

The profiles.clj mechanism deserves one warning. It lets lein-environ populate .lein-env from the Leiningen project map, which is convenient in development and a footgun in production: if .lein-env is present in the artifact working directory, its values outrank environment variables. A stale .lein-env baked into a deploy directory will silently override what the platform injected.

cprop — Explicit Multi-Source Precedence

cprop’s pitch is that every configuration approach has a hole: env-only means a hundred exported variables, classpath-only means wrestling with uberjar META-INF, string-only means no data structures, and global mutable state means you cannot run two modules with different configs. Its answer is an immutable map merged from an ordered list of sources.

1
2
;; deps.edn
{:deps {cprop/cprop {:mvn/version "0.1.21"}}}
1
2
3
4
5
6
(require '[cprop.core :refer [load-config]])

(def conf (load-config))

(conf :answer)                                    ;; 42
(get-in conf [:source :account :rabbit :vhost])    ;; "/z-broker"

load-config returns a plain map — no wrapper type, no protocol, no cursors required. The default merge order is documented and stable:

  1. classpath config.edn
  2. a file on the filesystem, pointed at by the conf system property
  3. custom maps passed via :merge
  4. system properties
  5. environment variables

Later sources win on matching keys. That ordering is the crux of the library, and it is also the source of its most common production bug: environment variables override everything by default. If someone exports DATOMIC__URL for a debugging session and forgets to unset it, that value beats your config.edn. cprop gives you an escape hatch:

1
(load-config :override-with {:datomic {:url "bar"}})

:override-with applies last, after everything else, which makes it the correct place for values that must be authoritative — a locked-down production endpoint, for example.

Nested env vars use a double underscore:

1
export DATOMIC__URL=foo
1
2
(load-config)
;; => {:datomic {:url "foo"}, ...}

Composition is where cprop is strongest. Sources are just functions returning maps:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
(require '[cprop.source :refer [from-file from-resource
                                from-system-props from-env]])

(load-config
  :resource "config.edn"
  :file "/etc/myapp/config.edn"
  :merge [{:datomic {:url "foo.bar"}}
          (from-file "/etc/myapp/secrets.edn")   ;; git-ignored
          (from-system-props)
          (from-env)])

That is a complete production precedence chain in eight lines, with the secrets file sitting above the packaged defaults and env vars able to override at the top. For teams migrating off Java-style deployment — .properties files, -D flags, and env vars all in play — cprop is the only one of the three that models the whole reality instead of a subset.

Where cprop hurts: the flexibility is also a debugging hazard. Five sources with implicit precedence means “why is this value wrong” becomes a source-by-source investigation. Aero’s single-file-with-profiles model answers that question in one glance. cprop also has the smallest community of the three (369 stars, 2.7M downloads), so unusual merge scenarios are less likely to have an answered question somewhere.

Pitfalls and Migration Notes

Never call read-config with a relative path in application code. It works in the REPL and fails from the uberjar. Always (clojure.java.io/resource ...), and for Aero includes pass resource-resolver when packaging.

Validate at startup, not at use. None of these three libraries validates that required keys exist. A nil database URL produces the same error whether it came from a missing env var, a typo’d keyword, or a merge that lost a level. Write one assert-config function that checks required paths with get-in and throws with the missing key name — five minutes of work that converts a 3 a.m. connection-pool mystery into a startup failure with a readable message.

Do not log the config map. Aero’s own documentation warns that process environments leak easily, and a (log/info conf) at startup dumps every secret in the graph. Log the keys, or log a redacted copy.

Prefer #or defaults over a second defaults file. Duplicating defaults across files is the exact failure Aero was designed to prevent. If you find yourself maintaining config.defaults.edn and config.prod.edn, you have recreated the problem.

Watch .lein-env in deploy directories. As noted above, it outranks environment variables in Environ’s resolution order. Exclude it from artifacts, or the platform’s injected config will be ignored.

Migrating from Environ to Aero is mostly mechanical: replace (env :db-url) with a config map read once at startup and injected into components. Doing this together with a lifecycle library is the natural moment to switch — our Component vs Integrant vs Mount comparison covers how to pass the resulting config map into the system graph without a global.

Migrating from cprop to Aero means flattening the merge chain into one file with profiles plus a git-ignored secrets include. Keep cprop’s precedence documentation on hand while you do it; you will need to decide, source by source, whether the new single file preserves the behaviour people rely on. If your build still uses Leiningen profiles, our Clojure build tools comparison is relevant because profile-based config is one of the things that breaks when moving to deps.edn — and whatever you choose, keep configuration out of your logging pipeline, as discussed in the Clojure logging libraries comparison.

FAQ

Is Aero still maintained in 2026? Yes. Aero’s last repository push was May 2026 and the current release on Clojars is 1.1.6. Development is slow but purposeful — the library is small and its design goals explicitly favour stability over feature growth.

Should I use Aero or Environ for Kubernetes deployments? Both work. Aero is the better fit when you have nested configuration and want typed values plus defaults in one file; Environ is better when every value is injected by the platform and you want no config files in the image at all. A common combination is Aero for structure with #env tags for the injected leaf values.

Does Environ support nested configuration? No. env is a flat map of keywords to strings, so nesting must be expressed in the key name (:database-url) and assembled in code. If you need real nesting, use Aero or cprop.

What is the difference between cprop’s merge order and Aero’s profiles? Aero resolves one file with inline profile selection at read time; there is a single source of truth. cprop merges several sources at runtime with a fixed precedence where environment variables win by default. cprop models messy heterogeneous deployments; Aero models a config document with per-environment differences.

How do I keep secrets out of git? With Aero, put them in a separate file referenced by #include and git-ignore that file; in production, mount it or override with env vars. With Environ, secrets are environment variables by construction. With cprop, add a from-file source pointing at a git-ignored secrets file late in the merge chain.

Can these libraries reload configuration without a restart? Not by themselves. All three return immutable maps. Reloading is a lifecycle concern: build the config map in a component or Integrant key so a restart of that component re-reads it, which keeps reload behaviour explicit rather than automatic.


💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com