Skip to content

tfso/njs-tfso-secret

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

njs-tfso-secret

Get secret values from file

Try to read file and returns content as value. Name of file is name of key, file location is determined by config.

Note: Reading is sync. Use only on startup.

install

npm install tfso/njs-tfso-secret

usage

const secret = require('njs-tfso-secret');
 
let value = secret.get('some-secret', 'somedefaultvalue');

 
//custom config
secret.config({
    location: '/run/secrets', // default
    silent: false // if false, log to console if error reading keys from file. Default is "true"
});
 

// use together with getenv
const env = require('getenv');

let valueWithDefaultFromEnv = secrets.get('PASSWORD',env.string('PASSWORD', ''))

About

Reads secret from files in a directory

Resources

Stars

Watchers

Forks

Packages

No packages published