Configuration loading and typed accessors.
Reads resources/conf/<env>/config.edn through Aero and exposes the
settings libraries need. Assembling an Integrant system from those settings
is the application's job — see wagoe.system-config in the monorepo, or the
config.clj that wagoe new generates.
This lives in a library because four published libraries used to reach for
it with requiring-resolve, which worked in the monorepo and in generated
projects and nowhere else — and wagoe.user's CLI resolved a db-spec that
generated projects never had (BOU-306).
Usage: (def config (load-config)) (db-spec config)
Configuration loading and typed accessors. Reads `resources/conf/<env>/config.edn` through Aero and exposes the settings libraries need. Assembling an Integrant system from those settings is the application's job — see `wagoe.system-config` in the monorepo, or the `config.clj` that `wagoe new` generates. This lives in a library because four published libraries used to reach for it with `requiring-resolve`, which worked in the monorepo and in generated projects and nowhere else — and `wagoe.user`'s CLI resolved a `db-spec` that generated projects never had (BOU-306). Usage: (def config (load-config)) (db-spec config)
(active-profile)(active-profile wag-env)The profile load-config picks when none is passed: WAG_ENV, else dev.
The profile `load-config` picks when none is passed: WAG_ENV, else dev.
(app-config config)Extract application-level configuration.
Args: config: Configuration map from load-config
Returns: Map with application settings
Extract application-level configuration. Args: config: Configuration map from load-config Returns: Map with application settings
(db-adapter config)Extract database adapter keyword from config.
Args: config: Configuration map from load-config
Returns: Keyword adapter (:sqlite, :h2, :postgresql, :mysql)
Extract database adapter keyword from config. Args: config: Configuration map from load-config Returns: Keyword adapter (:sqlite, :h2, :postgresql, :mysql)
(db-spec config)Extract database specification from config for the active adapter.
Args: config: Configuration map from load-config
Returns: Database spec map appropriate for the adapter
Example: {:adapter :sqlite :database-path "dev-database.db"}
Extract database specification from config for the active adapter.
Args:
config: Configuration map from load-config
Returns:
Database spec map appropriate for the adapter
Example:
{:adapter :sqlite :database-path "dev-database.db"}(db-spec-for-adapter adapter adapter-config)The adapter-specific half of db-spec. Public because the migration
path's conversion is this one, so the two cannot drift (BOU-647, BOU-658).
The adapter-specific half of `db-spec`. Public because the migration path's conversion is this one, so the two cannot drift (BOU-647, BOU-658).
(declared-secret-sources resource)(declared-secret-sources resource skip)(declared-secret-sources resource skip optional?)The sources the config at resource declares under a top-level
:secret-sources {:vault my.app/vault-source}, each symbol naming an
ISecretSource or a no-argument function returning one. Read before the
config itself, so every reader of the file sees them — the migration CLI as
much as the app. Keys in skip are not built: the caller has its own.
When optional?, a source that cannot be built is left out, so its
secrets read as an unknown source does under ::secrets/optional?.
The sources the config at `resource` declares under a top-level
`:secret-sources {:vault my.app/vault-source}`, each symbol naming an
`ISecretSource` or a no-argument function returning one. Read before the
config itself, so every reader of the file sees them — the migration CLI as
much as the app. Keys in `skip` are not built: the caller has its own.
When `optional?`, a source that cannot be built is left out, so its
secrets read as an unknown source does under `::secrets/optional?`.(default-tenant-id config)Extract default tenant ID for development/testing.
This provides a consistent tenant context for:
Args: config: Configuration map from load-config
Returns: UUID string of default tenant ID
Note: Production systems should NOT rely on defaults and must always specify tenant-id explicitly in requests.
Extract default tenant ID for development/testing. This provides a consistent tenant context for: - REPL development and testing - CLI operations without explicit tenant specification - Default test fixtures Args: config: Configuration map from load-config Returns: UUID string of default tenant ID Note: Production systems should NOT rely on defaults and must always specify tenant-id explicitly in requests.
(dev-like?)(dev-like? profile)Whether profile (keyword or string) is one people develop against: dev,
test or local. Nil or blank asks about active-profile, as a blank WAG_ENV
means dev (BOU-686).
Whether `profile` (keyword or string) is one people develop against: dev, test or local. Nil or blank asks about `active-profile`, as a blank WAG_ENV means dev (BOU-686).
(error-reporting-config config)Extract error reporting configuration.
Args: config: Configuration map from load-config
Returns: Map with error reporting provider and settings
Extract error reporting configuration. Args: config: Configuration map from load-config Returns: Map with error reporting provider and settings
(http-config config)Extract HTTP server configuration.
Args: config: Configuration map from load-config
Returns: Map with :port, :host, :join?, :port-range, :drain-timeout-ms and :virtual-threads? keys, plus :max-request-body when the config sets it
:drain-timeout-ms controls graceful shutdown: on stop the server stops accepting new connections, lets in-flight requests finish (bounded by this timeout, in milliseconds), then halts. 0 or nil disables graceful draining.
Extract HTTP server configuration. Args: config: Configuration map from load-config Returns: Map with :port, :host, :join?, :port-range, :drain-timeout-ms and :virtual-threads? keys, plus :max-request-body when the config sets it :drain-timeout-ms controls graceful shutdown: on stop the server stops accepting new connections, lets in-flight requests finish (bounded by this timeout, in milliseconds), then halts. 0 or nil disables graceful draining.
(load-config)(load-config {:keys [profile] :or {profile (active-profile)} :as opts})Load configuration from resources/conf/dev/config.edn using Aero.
Args: opts: Optional map with :profile key (defaults to :dev), and :secret-sources / :default-secret-source for #secret
Returns: Configuration map with resolved environment variables and profile selection
Example: (load-config) (load-config {:profile :test})
Load configuration from resources/conf/dev/config.edn using Aero.
Args:
opts: Optional map with :profile key (defaults to :dev), and
:secret-sources / :default-secret-source for #secret
Returns:
Configuration map with resolved environment variables and profile selection
Example:
(load-config)
(load-config {:profile :test})(logging-config config)Extract logging configuration.
Args: config: Configuration map from load-config
Returns: Map with logging provider and settings
Extract logging configuration. Args: config: Configuration map from load-config Returns: Map with logging provider and settings
(metrics-config config)Extract metrics configuration.
Args: config: Configuration map from load-config
Returns: Map with metrics provider and settings
Extract metrics configuration. Args: config: Configuration map from load-config Returns: Map with metrics provider and settings
(named-profile wag-env)The profile wag-env names, or nil when it is unset or blank: a blank
WAG_ENV is not a profile named "" (BOU-686).
The profile `wag-env` names, or nil when it is unset or blank: a blank WAG_ENV is not a profile named "" (BOU-686).
(normalize-env env)Normalize a WAG_ENV value to one of the short config directory names (dev, test, prod, acc).
Normalize a WAG_ENV value to one of the short config directory names (dev, test, prod, acc).
(read-config-resource resource profile)(read-config-resource resource profile opts)Read the config at resource (a URL) for profile. A missing #include
fails here, naming the file: Aero puts a placeholder in its place and the
application would start without whatever it held.
opts may carry :secret-sources, over those the file declares (see
declared-secret-sources), and :default-secret-source; see
wagoe.config.secrets.
Read the config at `resource` (a URL) for `profile`. A missing #include fails here, naming the file: Aero puts a placeholder in its place and the application would start without whatever it held. `opts` may carry `:secret-sources`, over those the file declares (see `declared-secret-sources`), and `:default-secret-source`; see `wagoe.config.secrets`.
(resolve-symbol sym)The value of the var a config file names by qualified symbol.
A missing namespace throws FileNotFoundException without ex-data; a namespace without the var returns nil. Both are the same config mistake, so both throw :configuration-error.
The value of the var a config file names by qualified symbol. A missing namespace throws FileNotFoundException without ex-data; a namespace without the var returns nil. Both are the same config mistake, so both throw :configuration-error.
(tracing-config config)Extract tracing configuration (defaults to the inert no-op tracer).
Extract tracing configuration (defaults to the inert no-op tracer).
(user-validation-config config)Extract user validation configuration.
Args: config: Configuration map from load-config
Returns: Map with user validation settings including:
Extract user validation configuration. Args: config: Configuration map from load-config Returns: Map with user validation settings including: - :email-domain-allowlist - Set of allowed email domains - :password-policy - Password complexity requirements - :name-restrictions - Name validation rules - :role-restrictions - Role assignment rules - :tenant-limits - Per-tenant user limits - :cross-field-validation - Cross-field validation rules
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |