Installations
npm install node-yaml-config
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.17.6
NPM Version
6.14.15
Score
96.4
Supply Chain
100
Quality
75.5
Maintenance
100
Vulnerability
98.6
License
Contributors
Unable to fetch Contributors
Languages
TypeScript (96.57%)
JavaScript (3.43%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
leafty
Download Statistics
Total Downloads
5,037,626
Last Day
8,029
Last Week
8,029
Last Month
93,366
Last Year
1,193,117
GitHub Statistics
23 Stars
35 Commits
7 Forks
5 Watching
2 Branches
3 Contributors
Bundle Size
47.97 kB
Minified
15.37 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
node-yaml-config@1.0.0
Size
11.15 kB
NPM Version
6.14.15
Node Version
14.17.6
Publised On
30 Sept 2021
Total Downloads
Cumulative downloads
Total Downloads
5,037,626
Last day
0%
8,029
Compared to previous day
Last week
-59.1%
8,029
Compared to previous week
Last month
7.2%
93,366
Compared to previous month
Last year
-50.9%
1,193,117
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
node-yaml-config
Write your configuration files for node.js in yaml
Installation
1npm install node-yaml-config
Usage
1var yaml_config = require('node-yaml-config'); 2 3var config = yaml_config.load(__dirname + '/config/config.yml'); 4 5console.log(config);
Or with Typescript:
1import { loadAsync } from 'node-yaml-config'; 2 3async function main() { 4 const config = await loadAsync(__dirname + '/config/config.yml'); 5 console.log(config); 6} 7main();
Configuration Files
In your configuration file:
1default: 2 server: 3 port: 3000 4 database: 5 host: 'localhost' 6 port: 27017 7development: 8 database: 9 db: 'dev_db' 10test: 11 database: 12 db: 'test_db' 13production: 14 server: 15 port: 8000 16 database: 17 db: 'prod_db' 18 user: 'dbuser' 19 password: 'pass' 20 cache: 21 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.
API
read(filename)
Reads the configuration found in filename
.
load(filename[, env])
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(filename)
Reload the configuration found in filename
. Later calls to load
will show the new configuration.
The file is loaded synchronously.
readAsync(filename)
Same as read
but returns a Promise.
loadAsync(filename[, env])
Same as load
but returns a Promise.
node-yaml-config keeps parsed yaml files in memory to avoid reading files again.
reloadAsync(filename)
Same as reload
but returns a Promise.
License
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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
Found 2/23 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/nodejs.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/nodejs.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-release.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/pre-release.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-release.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/pre-release.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-release.yaml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/pre-release.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-release.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/pre-release.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/publish.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/publish.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/publish.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/leafty/node-yaml-config/publish.yaml/main?enable=pin
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs.yaml:1
- Warn: no topLevel permission defined: .github/workflows/pre-release.yaml:1
- Warn: no topLevel permission defined: .github/workflows/publish.yaml:1
- Info: no jobLevel write permissions found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 16 are checked with a SAST tool
Reason
29 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2.4
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More