npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codemaniac-technologies/codemaniac-config

v1.0.0

Published

> CODEMANIAC Microservice Configuration module used to configure API services and > load environment specific configuration files.

Downloads

5

Readme

codemaniac-config

CODEMANIAC Microservice Configuration module used to configure API services and load environment specific configuration files.

Installation

  1. Install as an NPM package from its git repository:
    npm install https://github.com/CodeManiac-Technologies-Pvt-Ltd/codemaniac-config.git

Dependencies

  1. codemaniac-server module:

    Thie codemaniac-config modules works hand in hand with the codemaniac-server module. Though it can be imported independently, the codemaniac-server module automatically handles loading configurations for you.

  2. Config files: In the context of this module, there are two classes of config files being used in our projects:

    • Environment (dotenv) configs: These configuration files are used to build a set of process environment variables scoped to the environment the application is running in. An environment is denoted by the combination of the NODE_ENV variable (eg. dev, devgate, sqa, prod, etc.) and the client. In essence, the environment identifies the cluster the application is deployed to. The content of these config files generally includes usernames and secrets. And may also include other environment scoped information such as api urls.
  • Application (json) configs: These configuration files are specific to an application or service. These configs focus on the different configuration options scoped to the application itself. It includes the bulk of the options that are instantiated by the codemaniac-server module, including:
    • Which services/modules to load
    • Logging capabilities
    • General config data for use throughout the application

Specific config keys are shown below and full examples of the configuration files are included in the config folder.

Most configuration options are provided and maintained in the modules we utilize for development. For simplicity, include below is an amalgamation of serveral options currently provided in our modules and how the may be used. The options shown only serve as an example of what's available and should not be considered the official source documentation for module configurations. To obtain the actual documentation for a given option, please see the corresponding module.

codemaniac-server

Configuration Options:

  • host: Host object; encapsulates details occurred with the node.js server.

    Properties
    Example
    "host": {
      "port": 3000
    }
    • services:

      The services object encapsulates configuration deatils for a module. Properties are module specific. As it pertains to the codemaniac-server, the object is iterated through and each service/module is imported and instantiated through either an init or initialize method as defined on the imported object. The config element/object is passed to the initialize method, which creates and returns a corresponding instance of itself with the configuration details as passed.

      NOTE: GENERATED module instances are often expected to be shared as singletons across the application (e.g we use a single logger instance across all of our modules). If this functionality is need, ensure the module initializing the singleton is only added as dependency (package.json) in the aria-server module so it's not otherwise loaded locally in the module that depends upon it.

      Properties
      Example
      "services":{
        "helpearn": {
              "module: "codemaniac-ds-mysql",
              "poolAlias": "helpearn",
              "modelPaths": "helpearn",
              "user": "process.env.MYSQLDB_USER",
              "password": "process.env.MYSQLDB_PASSWORD",
              "connectionString": "process.env.MYSQLDB_CONNECTIONSTRING",
              "poolIncrement": 5,
              "poolMin": 10,
              "poolMax": 40,
              "poolTimeout": 10,
              "queueTimeout": 0,
              "queueRequests": true,
              "_enableStats": true
            }
      }
    • features

      The features object includes additional details used to configure the server instance.

      Properties
      "features": {
        "logRequests": true,
        "logErrors": true,
        "healthCheck": true,
        "healthCheckDiagnostics": true,
        "errorDiagnostics": true
      }

codemaniac-logger:

Configuration Options:

  • logger: Logger configuration object.

API

Object: codemaniacConfig

codemaniacConfig object is exported when requiring/importing the module.

const codemaniacConfig = require('codemaniac-config');
  • Returns: {codemaniacConfig}

Methods/Functions

module.exports.loadLocalEnvironment = loadLocalEnvironment; module.exports.loadLocalAppConfig = loadLocalAppConfig;

codemaniacConfig.get(key)

Retreives a configuration value from memory by key

  • key {string} - the key to retrevice, colon delimitted to denote nested object (e.g. 'services:helpearn:module' gets the services.helpearn.module value)
  • Returns: {Object/string}

codemaniacConfig.set(key, value)

  • key {string} - the key for which to set the value to, colon delimitted to denote nested object (e.g. 'services:helpearn:module' sets the services.helpearn.module value)
  • value {string} - the value to set the key to
  • Returns: void

codemaniacConfig.add(name, configObject)

Adds an additional object to the in-memory config object store. Overrides key if already defined.

  • name {String} - Name identifier for the configuration object in the store.
  • configObject {object} - The configuration object
  • Returns: void

codemaniacConfig.load([localFileConfig] = {})

  • localFileConfig {Object} - Configuration object providing local file paths to configs
  • localFileConfig.tls {Object} - Tls configuration object providing local file paths to tls files
  • localFileConfig.tls.certPath {string} - Path to tls cert file
  • localFileConfig.tls.keyPath {string} - Path to tls key file

Loads base configuration along with additional configurations files and data (e.g. from s3 or SSM) based on the base options passed. NOTE: Local env and application config files will be loaded if the following environment variables are set:

  • process.env.LOCAL_ENV_CONFIG_PATH {string} - Path to environment (.env) file
  • process.env.CODEMANIAC_LOCAL_APP_CONFIG_PATH {string} - Path to application config

codemaniacConfig.loadEnvConfig()

Loads .env file into memory or from SSM.

  • Returns: void

codemaniacConfig.loadEnvConfig.exposeEnvConfig()

Loads .env file key/value pairs into memory as process environment variables.

  • Returns: void

codemaniacConfig.loadAppConfig.subConfigEnvVariables(configObject)

Substitutes harcoded process environment variable strings with their in-meory values

  • configObject {Object} - The configuration object
  • Returns: {object} - The updated configObject with variables substituted.

codemaniacConfig.loadLocalAppConfig([configFilePath])

Loads application config.json file as specified by configFilePath into memory as a configuration object.

  • configFilePath {string} - path to the application config.json file -optional
  • Returns: void

codemaniacConfig.getSSMParameters(parameters, [withDecryption])

Retreives SSM parameteres as requested.

  • parameters {Array} - the configuration object

  • withDecryption {boolean} - Option to decrypt secure string parameters. Defaults to false.

  • Returns: {Promise} - The parameters object. See AWS documentation for specific details.

Usage

  1. Include the following in your code files:
const codemaniacConfig = require('codemaniac-config');
const configObject = {
	services: {
		dataprotect: {
			clientKeySpecs: {
				default: {
					currentSpec: 'key-spec-value',
				},
			},
		},
	},
};

// add the configObject
ariaConfig.config.add('local-config', configObject);

//get a key value ("key-spec-value")

const keySpec = codemaniacConfig.config.get(
	'services:dataprotect:clientKeySpecs:default:currentSpec'
);

//set a value

const newKeySpec = codemaniacConfig.config.set(
	'services:dataprotect:clientKeySpecs:default:currentSpec',
	'new-key-spec-value'
);

Tests

  1. To run the test suite, first install the dependencies the run npm test
npm install
npm test

An HTML copy of the coverage report will be written to the ./coverage directory.

  1. Execute tests without code coverage reports:
npm run test-only
  1. Check adherance to style guidelines and detect potential problems:
npm run lint
  1. Check for known security exploits of dependent packages:
npm run security