Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "confme", | ||
"version": "0.0.5", | ||
"description": "Opinionated config library that allows you to have complex config and behaves according to 12-factors apps rules ", | ||
"version": "0.0.6", | ||
"description": "Opinionated config library that allows you to have complex config and behaves according to 12-factor app rules ", | ||
"main": "src/confme.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
@@ -5,9 +5,9 @@ ## confme | ||
- It is build on top of ["dotenv-defaults"](https://www.npmjs.com/package/dotenv-defaults) | ||
- It is build on top of [dotenv-defaults](https://www.npmjs.com/package/dotenv-defaults) | ||
- Uses [LIVR](https://www.npmjs.com/package/livr) ([with extra rules](https://www.npmjs.com/package/livr-extra-rules)) for config schema validation. | ||
- Follows the ideas of ["Twelve Factor App"](https://12factor.net/config) | ||
- Follows the ideas of [Twelve Factor App](https://12factor.net/config) | ||
### How does it work? | ||
"confme" loads your config and replaces placeholders with environment variables. For environemnt loading it uses ["dotenv-defaults"](https://www.npmjs.com/package/dotenv-defaults), so you can create ".env.defaults" file to set default values of environment variables. If you have placeholders for non set environment variables then "confme" will throw an error. | ||
"confme" loads your config and replaces placeholders with environment variables. For environemnt loading it uses [dotenv-defaults](https://www.npmjs.com/package/dotenv-defaults), so you can create ".env.defaults" file to set default values of environment variables. If you have placeholders for non set environment variables then "confme" will throw an error. | ||
@@ -83,2 +83,3 @@ You can pass a path to a JSON file with [LIVR](https://www.npmjs.com/package/livr) rules as a second argument. In this case, it will use [LIVR](https://www.npmjs.com/package/livr) ([with extra rules](https://www.npmjs.com/package/livr-extra-rules)) to validate the config. | ||
- `node app.js` | ||
- `DOMAIN=myapp.com PORT=80 node app.js` | ||
- `DOMAIN=myapp.com PORT=80 node app.js` | ||
- `PORT='AAA' node app.js` |
@@ -29,3 +29,7 @@ require("dotenv-defaults").config(); | ||
if (!validConfig) { | ||
throw new Error(JSON.stringify(validator.getErrors(), null, 2)); | ||
const error = { | ||
FAILED_CONFIG: config, | ||
ERRORS: validator.getErrors() | ||
}; | ||
throw new Error(JSON.stringify(error, null, 2)); | ||
} | ||
@@ -32,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5641
74
84