{"id":19621498,"url":"https://github.com/commenthol/configg","last_synced_at":"2026-05-17T02:36:36.076Z","repository":{"id":25824530,"uuid":"29263786","full_name":"commenthol/configg","owner":"commenthol","description":"A node configuration manager","archived":false,"fork":false,"pushed_at":"2020-04-19T06:17:25.000Z","size":143,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-09T11:40:05.959Z","etag":null,"topics":["configuration","manager","node-js"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commenthol.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-14T20:17:55.000Z","updated_at":"2020-04-19T06:17:28.000Z","dependencies_parsed_at":"2022-07-25T15:02:34.093Z","dependency_job_id":null,"html_url":"https://github.com/commenthol/configg","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fconfigg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fconfigg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fconfigg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fconfigg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commenthol","download_url":"https://codeload.github.com/commenthol/configg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240915011,"owners_count":19878082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","manager","node-js"],"created_at":"2024-11-11T11:23:19.247Z","updated_at":"2025-10-20T01:47:55.050Z","avatar_url":"https://github.com/commenthol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# configg\n\n\u003e A Node configuration manager\n\n[![NPM version](https://badge.fury.io/js/configg.svg)](https://www.npmjs.com/package/configg/)\n[![Build Status](https://secure.travis-ci.org/commenthol/configg.svg?branch=master)](https://travis-ci.org/commenthol/configg)\n\n\"configg\" organizes _hierarchical_ configurations for your App deployments\nwhile keeping the different configurations for your App and its modules _isolated_.\n\nStarting from  a defined set of default parameters, your App gets extended\nfor its different deployment environments (development, staging, production, ...),\noptional the hosts it's going to run and/or the instance it uses.\n\nThe different environments get controlled using different environment\nvariables (e.g. `NODE_ENV` for deployment).\n\nTo provide a clean separation between code and config as proclaimed by\n[The Twelve-Factor App][] each App or module can get its own configuration\nfor the different deployment environments.\n\nConfigurations are stored in configuration files inside the `/config` folder\nwhich resides next to a `package.json` file.\nIsolation (i.e. a module or App can only access its associated configuration)\nis maintained by extracting name and version from the `package.json` file.\nThis allows extending/ overwriting values for modules from your App-config\nor even a module which includes other sub-modules.\n\nExtensible with plugins... Check npm for keyword [configg-plugin][].\n\nThis project is inspired from [node-config][].\n\n## Table of Contents\n\n\u003c!-- !toc (minlevel=2 omit=\"Table of Contents\") --\u003e\n\n* [Quick Start](#quick-start)\n  * [Use module overrides](#use-module-overrides)\n* [Plugins](#plugins)\n* [Documentation](#documentation)\n* [Contribution and License Agreement](#contribution-and-license-agreement)\n* [License](#license)\n\n\u003c!-- toc! --\u003e\n\n## Quick Start\n\nThe following examples use [Hjson][] but [other file formats](./doc/documentation.md#file_formats)\nincluding Js, JSON are supported.\n\nAll examples can be found in the [examples folder](./examples).\nRun `run.sh` to see things in action.\n\n**Install configg in your App directory**\n\n```bash\n$ npm install configg\n$ mkdir config\n```\n\n**Define default values for your App**\n\n```js\n/* ./config/default.hjson */\n{\n  config: { // \u003c always start with a config object...\n    backend: {\n      // configuration values of your app/ module go in here\n      host: \"test-system\",\n      port: 8080,\n      timeout: 3600\n    }\n  }\n}\n```\n\n**Define production overrides**\n\n```js\n/* ./config/production.hjson */\n{\n  config: {\n    backend: {\n      host: \"production-system\",\n      path: \"/path-on-prod\"\n    }\n  }\n}\n```\n\n**Add to your code**\n\n```js\n/* ./index.js */\nvar config = require('configg')()\nconsole.log(config.get('config.backend'))\n```\n\nRunning on development:\n\n```\n$ node index.js\n{ host: 'test-system', port: 8080, timeout: 3600 }\n```\n\nRunning on production:\n\n```\n$ export NODE_ENV=production\n$ node index.js\n{ host: 'production-system', port: 8080, timeout: 3600, path: '/path-on-prod' }\n```\n\n### Use module overrides\n\nAssuming you now want to add a database connection to your Application\nusing a \"my-database\" module.\n\nIn development you'd like to use the [default settings](./examples/node_modules/my-database/config/default.js)\nprovided within \"my-database\" but change the host and credentials.\n\nAll examples can be found in the [examples folder](./examples).\nRun `run-database.sh` to see things in action.\n\n```js\n/* /node_modules/my-database/config/default.js */\nmodule.exports = {\n  config: {\n    host: 'test-db',\n    port: 1529,\n    credentials: {\n      user: 'test',\n      pass: '1234'\n    }\n  },\n  common: {\n    pool: false\n  }\n}\n```\n\n**Our sample database module**\n\n```js\n/* database.js */\nvar config = require('configg')()\n\nconsole.log('---- Module \"my-database\" ----')\nconsole.log(config.get('config'))\n\nmodule.exports = {}\n```\n\n**Application with module \"my-database\"**\n\n```js\n/* ./index-database.js */\nvar config = require('configg')()\nvar database = require('my-database')\n\nconsole.log('---- Application ----')\nconsole.log(config.get('config.backend'))\n```\n\n**Running the App in development:**\n\n```\n$ NODE_ENV=\"\" node index-database.js\n---- Module \"my-database\" ----\n{ host: 'test-db',\n  port: 1529,\n  credentials: { user: 'test', pass: '1234' } }\n---- Application ----\n{ host: 'test-system', port: 8080, timeout: 3600 }\n```\n\nFor you productions settings you like to change to a different user and password using \"my-database\" as a module.\nIn your Application configuration add a branch named after the \"my-database\" module:\n\n```js\n/* ./config/production.hjson */\n{\n  config: { //\u003c The config for the current module\n    backend: {\n      host: \"production-system\",\n      path: \"/path-on-prod\"\n    }\n  },\n  \"my-database\": {  //\u003c Needs to be the name of the module!\n    host: \"production-db\",\n    credentials: {\n      user: 'admin',\n      pass: 'always-on-the-1'\n    }\n  },\n  common: {\n    pool: true\n  }\n}\n```\n\n**Runnning in production mode:**\n\n```\n$ node index-database.js --NODE_ENV=production\n---- Module \"my-database\" ----\n{ host: 'production-db', port: 1529,\n  credentials: { user: 'admin', pass: 'always-on-the-1' } }\n---- Application ----\n{ host: 'production-system', port: 8080, timeout: 3600, path: '/path-on-prod' }\n```\n\n## Plugins\n\nCheck npm for keyword [configg-plugin][].\n\nTo use plugins add a `plugins` array to the `default` or any config file.\n\n```js\nmodule.exports = {\n  config: {\n    // ...\n  },\n  common: {\n    // ...\n  },\n  plugins: [\n    ['configg-plugin-vault-nacl']\n  ]\n}\n```\n\nIf you like to write your own plugin check out [docs/plugins.md](./docs/plugins.md).\n\n## Documentation\n\nFurther documentation is at [docs/documentation.md](./docs/documentation.md).\n\n## Contribution and License Agreement\n\nIf you contribute code to this project, you are implicitly allowing your\ncode to be distributed under the MIT license. You are also implicitly\nverifying that all code is your original work or correctly attributed\nwith the source of its origin and license.\n\n## License\n\nCopyright (c) commenthol (MIT License)\n\nSee [LICENSE][] for more info.\n\n[LICENSE]: ./LICENSE\n[The Twelve-Factor App]: https://12factor.net\n[Hjson]: https://laktak.github.io/hjson/\n[node-config]: https://npmjs.com/package/node-config\n[configg-plugin-vault-nacl]: https://npmjs.com/package/configg-plugin-vault-nacl\n[configg-plugin]: https://www.npmjs.com/search?q=keywords:configg-plugin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fconfigg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommenthol%2Fconfigg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fconfigg/lists"}