Classes
Methods
# addISecretConfig(config)
Add a new secret configuration dynamically.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
ISecretConfig
|
Configuration block to append. |
# get(key) → {string|number}
Get a loaded secret value or fallback to env variables.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
Secret identifier. |
Secret value.
string
|
number
# getConfiguredSecrets() → {Array.<string>}
Get all configured secret key names.
Array of secret identifiers.
Array.<string>
# getISecretConfig(secretName) → {ISecretKey|undefined}
Get configuration for a specific secret.
Parameters:
| Name | Type | Description |
|---|---|---|
secretName |
string
|
Secret identifier. |
Matching secret definition, if any.
ISecretKey
|
undefined
# getLoadedKeys() → {Array.<string>}
Get all loaded secret keys (for debugging).
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. |
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. |
# 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. |
# has(key) → {boolean}
Check if a secret exists in memory.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
Secret identifier. |
True when the secret is cached.
boolean
# isSecretsLoaded() → {boolean}
Check if secrets have been loaded.
True when the cache has been populated.
boolean
# loadAllFallbacks() → {void}
Load all fallback values (emergency fallback) when Vault fails entirely.
void
# async loadSecrets() → {Promise.<void>}
Load secrets from Vault dynamically based on configuration.
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. |
Resolves when the vault section is processed.
Promise.<void>
# validateRequiredSecrets()
Validate that all required secrets were loaded.
When required secrets are missing.
Error
# static getInstance() → {VaultSecrets}
Retrieve the singleton instance of the secrets manager.
Vault secrets manager instance.