Liking cljdoc? Tell your friends :D

wagoe.platform.shell.adapters.database.config

Configuration-driven database adapter management.

This namespace provides functionality to read database configuration from config.edn and only load adapters that are marked as :active. This allows for optimized deployments where only required database drivers are loaded.

Key Features:

  • Configuration-driven adapter loading
  • Environment-specific database configs
  • Graceful handling of inactive adapters
  • JDBC driver optimization (only load needed drivers)

Usage: (require '[wagoe.platform.shell.adapters.database.config :as db-config])

(db-config/get-active-adapters "dev") ; Get active adapters for dev env (db-config/adapter-active? :postgresql) ; Check if adapter is active

Configuration-driven database adapter management.

This namespace provides functionality to read database configuration from
config.edn and only load adapters that are marked as :active. This allows
for optimized deployments where only required database drivers are loaded.

Key Features:
- Configuration-driven adapter loading
- Environment-specific database configs
- Graceful handling of inactive adapters
- JDBC driver optimization (only load needed drivers)

Usage:
  (require '[wagoe.platform.shell.adapters.database.config :as db-config])
  
  (db-config/get-active-adapters "dev")     ; Get active adapters for dev env
  (db-config/adapter-active? :postgresql)    ; Check if adapter is active
raw docstring

*config-cache*clj

Cache for loaded configurations to avoid repeated file reads

Cache for loaded configurations to avoid repeated file reads
sourceraw docstring

*default-environment*clj

source

adapter-active?clj

(adapter-active? adapter-type env)

Check if a specific adapter type is active in environment

Check if a specific adapter type is active in environment
sourceraw docstring

clear-config-cache!clj

(clear-config-cache!)

Clear configuration cache (useful for testing)

Clear configuration cache (useful for testing)
sourceraw docstring

config->db-configclj

(config->db-config config-key config)

Convert configuration entry to database adapter config

Convert configuration entry to database adapter config
sourceraw docstring

config-summaryclj

(config-summary env)

Get summary of database configuration for environment

Get summary of database configuration for environment
sourceraw docstring

detect-environmentclj

(detect-environment)

Detect current environment from various sources, with the aliases the config loader accepts resolved: development is dev (BOU-585).

Detect current environment from various sources, with the aliases the
config loader accepts resolved: `development` is `dev` (BOU-585).
sourceraw docstring

disposable-environment?clj

(disposable-environment? env)

True when env names a database that is safe to seed.

Callers must pass the environment resolved by detect-environment, not a direct read of WAG_ENV — the connection uses the full precedence chain (-Denv > WAG_ENV > ENV > ENVIRONMENT), and a guard that asks a narrower question than the connection is not a guard.

True when `env` names a database that is safe to seed.

Callers must pass the environment resolved by `detect-environment`, not a
direct read of WAG_ENV — the connection uses the full precedence chain
(-Denv > WAG_ENV > ENV > ENVIRONMENT), and a guard that asks a narrower
question than the connection is not a guard.
sourceraw docstring

disposable-envsclj

The profiles whose database may be seeded: resettable-envs.

The profiles whose database may be seeded: `resettable-envs`.
sourceraw docstring

get-active-adaptersclj

(get-active-adapters env)

Get list of active database adapter types for environment

Get list of active database adapter types for environment
sourceraw docstring

get-active-adapters-from-configclj

(get-active-adapters-from-config config-map)

Get active adapter configurations from config map

Get active adapter configurations from config map
sourceraw docstring

get-active-db-configclj

(get-active-db-config)

Get the first active database configuration for environment.

This is used by the migration system which operates on a single database. If multiple databases are configured, returns the first one.

Args: None (uses detected environment)

Returns: Database adapter configuration map with :datasource

Throws: Exception if no active database is configured

Get the first active database configuration for environment.

This is used by the migration system which operates on a single database.
If multiple databases are configured, returns the first one.

Args:
  None (uses detected environment)

Returns:
  Database adapter configuration map with :datasource

Throws:
  Exception if no active database is configured
sourceraw docstring

get-active-db-configsclj

(get-active-db-configs env)

Get database adapter configurations for all active databases in environment

Get database adapter configurations for all active databases in environment
sourceraw docstring

get-all-database-configsclj

(get-all-database-configs config-map)

Get all database configurations (active + inactive) from config map

Get all database configurations (active + inactive) from config map
sourceraw docstring

get-database-configsclj

(get-database-configs env)

Get database configurations for environment

Get database configurations for environment
sourceraw docstring

get-inactive-adaptersclj

(get-inactive-adapters config-map)

Get inactive adapter configurations from config map

Get inactive adapter configurations from config map
sourceraw docstring

getenvclj

(getenv k)

Environment variable lookup. Exists as a var (rather than inline interop) so tests can redef it — env vars cannot be modified inside a JVM.

Environment variable lookup. Exists as a var (rather than inline interop)
so tests can redef it — env vars cannot be modified inside a JVM.
sourceraw docstring

load-configclj

(load-config env)

Load configuration for environment with caching

Load configuration for environment with caching
sourceraw docstring

merge-configsclj

(merge-configs base-config override-config)

Merge two configuration maps

Merge two configuration maps
sourceraw docstring

(print-config-summary env)

Print formatted configuration summary for debugging

Print formatted configuration summary for debugging
sourceraw docstring

reset-refusalclj

Why a reset was refused, and what to do instead.

Why a reset was refused, and what to do instead.
sourceraw docstring

resettable-environment?clj

(resettable-environment? env)

True when env, as detect-environment resolves it, may be reset.

True when `env`, as `detect-environment` resolves it, may be reset.
sourceraw docstring

resettable-envsclj

The profiles db:reset may drop every table in, and db:seed may fill: one allowlist, so a profile that can be reset can be seeded again (BOU-588). Anything else — prod, an unknown name, a blank one — changes its schema through migrations. Compare against detect-environment, which resolves aliases.

The profiles `db:reset` may drop every table in, and `db:seed` may fill:
one allowlist, so a profile that can be reset can be seeded again
(BOU-588). Anything else — prod, an unknown name, a blank one — changes its
schema through migrations. Compare against `detect-environment`, which
resolves aliases.
sourceraw docstring

valid-adapter-config?clj

(valid-adapter-config? adapter-key config)

Validate adapter configuration (wrapper for validate-adapter-config)

Validate adapter configuration (wrapper for validate-adapter-config)
sourceraw docstring

valid-config-structure?clj

(valid-config-structure? config)

Validate that config has required structure

Validate that config has required structure
sourceraw docstring

validate-adapter-configclj

(validate-adapter-config adapter-type config)

Validate that an adapter configuration has required keys

Validate that an adapter configuration has required keys
sourceraw docstring

validate-database-configsclj

(validate-database-configs env)

Validate all database configurations for environment

Validate all database configurations for environment
sourceraw docstring

with-environmentclj

(with-environment env f)

Execute function with specific environment context

Execute function with specific environment context
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close