🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

@avanio/variable-util-node

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avanio/variable-util-node

nodejs env util

Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
121
175%
Maintainers
3
Weekly downloads
 
Created
Source

variable-util-node

NodeJS loaders for @avanio/variable-util

install

npm i @avanio/variable-util @avanio/variable-util-node --save

Documentation

Examples

setLogger(console); // or log4js or winston
// Docker secret files
const dockerEnv = new DockerSecretsConfigLoader({fileLowerCase: true}).getLoader;
// settings json file (i.e. modified on pipeline or agent)
const fileEnv = new FileConfigLoader({fileName: './settings.json', type: 'json'}).getLoader;
const fileEnv = new FileConfigLoader(async () => ({fileName: './settings.json', type: 'json'})).getLoader;

const urlParser = new UrlParser({urlSanitize: true}); // urlSanitize hides credentials from logs

// lookup from: env => JSON file "settings.json" => Docker "/run/secrets/database_uri"
const databaseUrl: URL = await getConfigVariable('DATABASE_URI', [env(), fileEnv(), dockerEnv()], urlParser, undefined, {showValue: true});

// example override key: env => JSON file "settings.json" => Docker "/run/secrets/xxyyzz-database"
const databaseUrl: URL = await getConfigVariable('DATABASE_URI', [env(), fileEnv(), dockerEnv('xxyyzz-database')], urlParser, undefined, {showValue: true});

// lookup from: env => JSON file "settings.json" with key MONGODB => Docker "/run/secrets/database_uri"
const databaseUrl: URL = await getConfigVariable('DATABASE_URI', [env(), fileEnv('MONGODB'), dockerEnv()], urlParser, undefined, {showValue: true});

FAQs

Package last updated on 13 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts