Create a ticket
Sign in Sign up
Locker support Locker support
Results

No results found.

Home Locker Secrets Manager Developer tools Secrets - SDK NodeJS Usages Get secrets
Vietnamese English
Get secrets

Methods:

  • list: list all secrets

list: () => Promise<Secret[]>

  • listSync: list all secrets, but synchronized

listSync: () => Secret[]

  • get: get a secret by key and environment name (optional, default to environment ALL), can return a default value if no secret is found

get: (key: string, env?: string, defaultValue?: string) => Promise<string | undefined>

  • getSync: get a secret but synchronized

getSync: (key: string, env?: string, defaultValue?: string) => string | undefined

Example:

// Get list secrets quickly
const secrets = await locker.list()
// or
const secrets = locker.listSync()

// Get a secret value by secret key
// Replace 'ENVIRONMENT' with null or undefined for the enviroment ALL
const secretValue1 = await locker.get('SECRET_NAME_1')
const secretValue2 = await locker.get('SECRET_NAME_2', 'ENVIRONMENT')
const secretValue3 = await locker.get('SECRET_NAME_3', 'ENVIRONMENT', 'default value')
// or
const secretValue3 = locker.getSync('SECRET_NAME_3', 'ENVIRONMENT', 'default value')
 
Was this page helpful?
No
Yes
Join Our Community