
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
nails-config
Advanced tools
This plugin provides configuration utilities for nails-framework.
It adds a node-etc instance to your app configured to load configuration details from a variety of sources.
This is a core plugin and is automatically included with nails-framework.
Configuration details are read from each source and deep-merged in to a single object. Sources are loaded in order of priority and don't overwrite existing keys. This makes it possible to override values using command line arguments or environment variables.
The following sources are loaded by default, in order of priority:
Parsed with node-optimist
Environment variables should be prefixed with the name of your application as set in package.json
(eg. $myapp_apikey
.) Defaults to $nails_
when the field can't be found.
Loads all JSON files from config/{$NODE_ENV}/
. Files prefixed with config.
are deep-merged with the config object and other files are nested under keys based on their filename (with the extension removed.)
By convention plugins look for a config key based on their name so using seperate files does help to stay organised.
myapp/
|- config/
|- development/
|- config.development
|- config.secrets
|- pluginName.json
|- nails-web.json
|- etc..
|- production/
|- config.development
|- config.secrets
|- pluginName.json
|- nails-web.json
|- etc..
|- staging/
|- etc/
{
"name": "Foo",
"age": 62,
"hostname": "127.0.0.1",
"port": 3000,
"meta": {
"yes": "no",
"bing": {
"bang": true,
"this": "that"
}
}
}
Default values can be set by plugins as a fallback.
Retrieves the given key from the configuration store. Use a :
delimiter to fetch specific keys from objects.
Example:
var name = app.config.get('pluginName:name') // String "Foo"
, age = app.config.get('pluginName:age') // Number 62
, all = app.config.get('pluginName'); // Object { name: 'foo', age: 62, <etc> }
Creates or modifies the given key. Primitives will override exsting values whereas Objects and Arrays will merge.
Example:
app.config.set('pluginName:name', 'Bar'); // Overwritten
app.config.set('pluginName', { // Merged
name: 'Jim',
age: 35
});
Refer to the node-etc documentation for additional methods.
The MIT License (MIT)
Copyright (c) 2013 James Wyse james@jameswyse.net
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Nails Configuration
We found that nails-config 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.