Class

VaultSecrets

VaultSecrets()

Vault-backed secrets manager responsible for loading and caching sensitive values.

Constructor

# new VaultSecrets()

View Source config/vault-secrets.js, line 8

Classes

VaultSecrets

Methods

# addISecretConfig(config)

Add a new secret configuration dynamically.

Parameters:
Name Type Description
config ISecretConfig

Configuration block to append.

View Source config/vault-secrets.js, line 272

# get(key) → {string|number}

Get a loaded secret value or fallback to env variables.

Parameters:
Name Type Description
key string

Secret identifier.

View Source config/vault-secrets.js, line 252

Secret value.

string | number

# getConfiguredSecrets() → {Array.<string>}

Get all configured secret key names.

View Source config/vault-secrets.js, line 280

Array of secret identifiers.

Array.<string>

# getISecretConfig(secretName) → {ISecretKey|undefined}

Get configuration for a specific secret.

Parameters:
Name Type Description
secretName string

Secret identifier.

View Source config/vault-secrets.js, line 295

Matching secret definition, if any.

ISecretKey | undefined

# getLoadedKeys() → {Array.<string>}

Get all loaded secret keys (for debugging).

View Source config/vault-secrets.js, line 333

Array of cached secret names.

Array.<string>

# getVaultConfig(secretName) → {ISecretConfig|undefined}

Get vault configuration for a specific secret.

Parameters:
Name Type Description
secretName string

Secret identifier.

View Source config/vault-secrets.js, line 310

Matching vault configuration, if any.

ISecretConfig | undefined

# handleSecretKeyFallback(secretKey, results)

Handle fallback for a single secret key.

Parameters:
Name Type Description
secretKey ISecretKey

Definition of the secret key.

results object

Aggregate counters.

success number

Count of successfully loaded secrets.

failed number

Count of failures.

fallbacks number

Count of fallback usages.

View Source config/vault-secrets.js, line 175

# handleVaultFallback(config, results)

Handle fallback for all keys in a vault configuration.

Parameters:
Name Type Description
config ISecretConfig

Vault configuration definition.

results object

Aggregate counters.

success number

Count of successfully loaded secrets.

failed number

Count of failures.

fallbacks number

Count of fallback usages.

View Source config/vault-secrets.js, line 203

# has(key) → {boolean}

Check if a secret exists in memory.

Parameters:
Name Type Description
key string

Secret identifier.

View Source config/vault-secrets.js, line 325

True when the secret is cached.

boolean

# isSecretsLoaded() → {boolean}

Check if secrets have been loaded.

View Source config/vault-secrets.js, line 264

True when the cache has been populated.

boolean

# loadAllFallbacks() → {void}

Load all fallback values (emergency fallback) when Vault fails entirely.

View Source config/vault-secrets.js, line 231

void

# async loadSecrets() → {Promise.<void>}

Load secrets from Vault dynamically based on configuration.

View Source config/vault-secrets.js, line 68

Resolves when all secrets are processed.

Promise.<void>

# async loadVaultSecrets(config, results) → {Promise.<void>}

Load secrets from a specific Vault key based on its configuration.

Parameters:
Name Type Description
config ISecretConfig

Vault configuration definition.

results object

Aggregate counters.

success number

Count of successfully loaded secrets.

failed number

Count of failures.

fallbacks number

Count of fallback usages.

View Source config/vault-secrets.js, line 117

Resolves when the vault section is processed.

Promise.<void>

# validateRequiredSecrets()

Validate that all required secrets were loaded.

View Source config/vault-secrets.js, line 213

When required secrets are missing.

Error

# static getInstance() → {VaultSecrets}

Retrieve the singleton instance of the secrets manager.

View Source config/vault-secrets.js, line 57

Vault secrets manager instance.

VaultSecrets