Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
configurine-picker
Advanced tools
Logic for picking config values based on a given app name, app version, and environment name fron configurine
Logic for picking config values based on a given app name, app version, and environment name from Configurine
You may depend on the module by putting an entry in the dependencies section of your package.json file with the appropriate version:
"configurine-picker": "0.x.x"
You may also use npm to install the module and have it saved to your package.json using:
npm install configurine-picker --save
This module takes a set of config entries and filters them down to one of each name by picking the one whose associations best match the given application and environment using the following priority:
The function exported by this module takes one options
paramter and returns an object that contains the names provided and the corresponding values that were picked. The expected properties on the options
object are:
appName
- the name of the application to match on (required)appVersion
- the version of the application to match on (required)environmentName
- the name of the environment to match on (required)names
- an array of strings that represent the names of the config entries pick forassociationPriority
- tells the picker which association to give priority to: 'app' or 'env'. Defaults to 'app'entries
- the collection of config entries from configurine to pick from (required)Example:
var picker = require('configurine-picker');
// example set of config entries from configurine for demo purposes
var entries = [
{
name: 'foo',
value: 'bar',
associations: {
applications: [{
name: 'my-app',
versions: ['1.0.0']
}],
environments: []
},
isActive: true,
isSensitive: false,
owner: 'me'
},
{
name: 'foo',
value: 'baz',
associations: {
applications: [],
environments: ['production']
},
isActive: true,
isSensitive: false,
owner: 'me'
}
];
var config = picker({
names: ['foo'],
appName: 'my-app',
appVersion: '1.0.0',
environmentName: 'production',
associationPriority: 'app',
entries: entries
});
console.log(config.foo); // 'bar'
config = picker({
names: ['foo', 'other'],
appName: 'my-app',
appVersion: '1.0.0',
environmentName: 'production',
associationPriority: 'env',
entries: entries
});
console.log(config.foo); // 'baz'
console.log(config.other); // undefined
FAQs
Logic for picking config values based on a given app name, app version, and environment name fron configurine
The npm package configurine-picker receives a total of 1 weekly downloads. As such, configurine-picker popularity was classified as not popular.
We found that configurine-picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.