![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
confess
is a configuration wrapper around
convict
.
Setting up configuration and using configuration seem to be two different
concerns approached by other configuration modules. Convict is a module that has
(in my opinion) done a really good job at setting up configuration. It's
extensible, easy to integrate with in any system, and can be customized to do
just about anything the other configuration loaders can do. Using it, though,
can be a pain. You create a config.js
or config/index.js
or something that
loads convict and configures your configuration. That's the good part. But when
you want to use your configuration, it's only available if you require()
it
from wherever you are in your file system, which could requires a lot of ../
.
This module makes abstracts my most common use cases of setting up configuration with convict, with the convenience of use a require without paths.
npm install --save confess
In the root of your project create a folder called config/
.
In this folder, there will be 3 classes of files:
Schema definition file - This is the file that defines the schema of the
main configuration options. This file should export an object that you would use
to define your convict
configuration. Documentation on how to set up the
schema can be found here.
The default name for this file is index.js
.
Default configuration file - This file gets loaded and merged into the
config object using convict
's
.load()
method.
The default name for this file is default.js
.
Environment configuration files - The default schema that gets loaded
includes and environment configuration that you can set with an environment
variable (NODE_ENV
) or with a flag (--env
). The default environment is
development
so it loads development.js
. It is recommended that you create
multiple environment configuration files, such as test
and production
. Any
configuration options set in these files with override those in default and the
schema defaults.
The object that gets returned is the convict
config object. So to get a config
value, just use it like you would in convict
.
'use strict';
var config = require('confess');
config.get('port');
config.get('session.secret');
For more documentation on things you can do with the convict
config object,
see their documentation;
You can override things like the folder and schema filename by putting a
.confessrc
file in the root of your project.
{
"extension": "js", // can be js or json
"schemaPrefix": "index",
"defaultPrefix": "default",
"defaultEnv": "development",
"configDir": "config", // relative dir to cwd
"cwd": "" // This defaults to what process.cwd() is
}
If anyone would like to add more file extension support, submit an issue or pull request. I stuck with just js
and json
because this is nodejs/iojs.
To view example folder/file structures, view the examples directory.
FAQs
This package has changed authors and will use this name for completely different functionality.
The npm package confess receives a total of 4 weekly downloads. As such, confess popularity was classified as not popular.
We found that confess 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.