
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
node-yaml-config
Advanced tools
Write your configuration files for node.js in yaml
npm install node-yaml-config
var yaml_config = require('node-yaml-config');
var config = yaml_config.load(__dirname + '/config/config.yml');
console.log(config);
Or with Typescript:
import { loadAsync } from 'node-yaml-config';
async function main() {
const config = await loadAsync(__dirname + '/config/config.yml');
console.log(config);
}
main();
In your configuration file:
default:
server:
port: 3000
database:
host: 'localhost'
port: 27017
development:
database:
db: 'dev_db'
test:
database:
db: 'test_db'
production:
server:
port: 8000
database:
db: 'prod_db'
user: 'dbuser'
password: 'pass'
cache:
dir: 'static'
node-yaml-config takes the configuration found in default, then overwrites it with the values found in the environment specific parts. The configuration file is loaded synchronously.
Reads the configuration found in filename
.
Load the configuration found in filename
with the environment based on NODE_ENV
. The environment can be forced with the env
argument.
node-yaml-config keeps parsed yaml files in memory to avoid reading files again.
Reload the configuration found in filename
. Later calls to load
will show the new configuration.
The file is loaded synchronously.
Same as read
but returns a Promise.
Same as load
but returns a Promise.
node-yaml-config keeps parsed yaml files in memory to avoid reading files again.
Same as reload
but returns a Promise.
Copyright (c) 2012-2021 Johann-Michael Thiebaut <johann.thiebaut@gmail.com>
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
Write your configuration files for node.js in yaml
The npm package node-yaml-config receives a total of 26,280 weekly downloads. As such, node-yaml-config popularity was classified as popular.
We found that node-yaml-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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.