{"id":18299346,"url":"https://github.com/democracyos/config","last_synced_at":"2025-04-05T13:34:39.852Z","repository":{"id":57211878,"uuid":"49017221","full_name":"DemocracyOS/config","owner":"DemocracyOS","description":"Node configuration json files loader. Overrideable by environment variables. Very opinionated.","archived":false,"fork":false,"pushed_at":"2020-05-30T10:53:52.000Z","size":92,"stargazers_count":6,"open_issues_count":11,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-04T06:18:46.129Z","etag":null,"topics":["configuration","environment","node","server","variable"],"latest_commit_sha":null,"homepage":"","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/DemocracyOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-01-04T19:08:08.000Z","updated_at":"2017-05-10T11:22:08.000Z","dependencies_parsed_at":"2022-08-30T18:41:24.589Z","dependency_job_id":null,"html_url":"https://github.com/DemocracyOS/config","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DemocracyOS","download_url":"https://codeload.github.com/DemocracyOS/config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223192604,"owners_count":17103564,"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","environment","node","server","variable"],"created_at":"2024-11-05T15:08:45.582Z","updated_at":"2024-11-05T15:08:46.714Z","avatar_url":"https://github.com/DemocracyOS.png","language":"JavaScript","readme":"Config\n======\n\n[![Build Status](https://travis-ci.org/DemocracyOS/config.svg?branch=master)](https://travis-ci.org/DemocracyOS/config) [![Greenkeeper badge](https://badges.greenkeeper.io/DemocracyOS/config.svg)](https://greenkeeper.io/)\n\nConfiguration manager for node apps. Keep all your default settings on a json file,\nand override them per environment, using another file or environment variables.\n\n| DISCLAIMER: Use https://github.com/DemocracyOS/dos-config, unless you want to customize default options.\n\n### Install\n\n`npm i democracyos-config -S`\n\n### Usage\n\n1- Create `defaults.json` file. It will define the schema of the config,\nincluding default values and types it should have:\n\n**/config/defaults.json**\n```json\n{\n  \"port\": 3000,\n  \"title\": \"My awesome app Defaults\"\n}\n```\n\n2- Environment specific overrides are optional, using `{NODE_ENV}.json` or\n`development.json` as default:\n\n**/config/development.json**\n```json\n{\n  \"title\": \"My awesome app on Development\"\n}\n```\n\n3- Only commit default values! You wouldn't want to commit any keys, etc.\n\n**/config/.gitignore**\n```\n*.json\n!defaults.json\n```\n\n4- Load your config, specify the path to where all the config files are located.\n\n**/config/index.js**\n```javascript\nmodule.exports = require('democracyos-config')({\n  path: __dirname\n})\n```\n\n5- Use it:\n\n**And, in your `/server.js`, or wherever:**\n```javascript\nvar config = require('./config')\n\nconsole.log(config.title) // My awesome app on Development\n```\n\n### Environment Variables\n\nYou can also define values using environment variables, this is the recommended\napproach for `production`.\n\n* Var names should be CONSTANT_CASE.\n  * e.g.: `mongoUrl` =\u003e `MONGO_URL`\n  * Scoped variables e.g.: `user.password` =\u003e `USER_PASSWORD`\n* `Arrays`s should be strings separated by commas.\n  * e.g.: `\"staff\": [\"mail@eg.com\", \"a@c.m\"]` =\u003e `STAFF=\"mail@eg.com,a@c.m\"`\n* `Boolean`s should be `true` or `false` as strings.\n  * e.g.: `\"rssEnabled\": false` =\u003e `RSS_ENABLED=\"false\"`\n* `Objects`s should be a JSON string.\n  * e.g.: `\"connectionData\": {}` =\u003e `CONNECTION_DATA='{\"ip\": \"127.0.0.1\", \"port\": 45333}'`\n* For more info, Types are casted using `/lib/cast-string.js`\n\n## Tests\n\n```\nnpm run test\n```\n\n## License\n* MIT\n* © 2017 [Demoracia en Red](http://democraciaenred.org)\n* More details under [LICENSE](https://github.com/DemocracyOS/config/blob/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemocracyos%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemocracyos%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemocracyos%2Fconfig/lists"}