{"id":18299354,"url":"https://github.com/democracyos/dos-config","last_synced_at":"2026-03-06T08:03:19.255Z","repository":{"id":69028037,"uuid":"55816242","full_name":"DemocracyOS/dos-config","owner":"DemocracyOS","description":"Frictionless, production-ready library for configuring Node.js apps","archived":false,"fork":false,"pushed_at":"2017-04-10T20:22:11.000Z","size":25,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-23T06:07:36.306Z","etag":null,"topics":[],"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-08T23:45:21.000Z","updated_at":"2024-03-25T14:11:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"70bb1ce7-417b-4856-a18b-9b1cea8adac2","html_url":"https://github.com/DemocracyOS/dos-config","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fdos-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fdos-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fdos-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DemocracyOS%2Fdos-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DemocracyOS","download_url":"https://codeload.github.com/DemocracyOS/dos-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":[],"created_at":"2024-11-05T15:08:47.063Z","updated_at":"2026-03-06T08:03:14.227Z","avatar_url":"https://github.com/DemocracyOS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DOS Config\n\nLibrary to configure node apps. At its core uses [DemocracyOS/config](https://github.com/DemocracyOS/config) but with sane defaults.\n\nKeep your default configs on `config/defaults.json`, override them with `config/{NODE_ENV}.json` or with environment variables.\n\n## Getting Started\n\n1 · Install it: `npm install --save dos-config`\n\n2 · Run the command: `./node_modules/.bin/dos-config-init`. It will create the folder `config` with the most basic defaults.\n\n3 · Profit 🙌\n\n```javascript\nvar config = require('dos-config')\n\nif (config.port) {\n  console.log(`The server should run at port ${config.port}. Go code it now.`)\n}\n```\n\n## Configuring your app\n\nFirst of all, `dos-config` will look for the `config/defaults.json` file, which will define the configuration structure with the default values.\n\nHere's a complete example, keep in mind that the keys of your json files should always be `camelCase`:\n\n```json\n{\n  \"port\": 3000,\n  \"mongoUrl\": \"mongodb://localhost/DemocracyOS-dev\",\n  \"staff\": [\n    \"some@example.com\",\n    \"another@example.com\"\n  ],\n  \"connectionData\": {},\n  \"auth\": {\n    \"user\": \"Fring\",\n    \"password\": \"always-be-secure-123!$\"\n  }\n}\n```\n\n* The most primitive values are `Integer` or `String`. Which work as expected.\n* `Array` values can only have `String`s inside.\n* The empty object `{}` means that it doesn't have a default value, but can be overriden by absolutely any JSON.\n\nAfter defining your `defaults`, you can override them using another json file on your current environment. For example, if you are on your development machine, create `config/development.json` and add there only the values you want to change (**always remember to .gitignore this file!**):\n\n```json\n{\n  \"port\": 8888,\n  \"connectionData\": {\n    \"domain\": \"localhost\",\n    \"port\": 27099,\n    \"user\": \"root\"\n  }\n}\n```\n\nExcellent! Now you only need to configure your production server.\n\nYou have two options; first, do the same as development, but create the file `config/production.json` on your server, and make sure the `NODE_ENV` environment variable is set to `production`.\n\nThe other and *recommended* option for production, is to use [environment variables](https://en.wikipedia.org/wiki/Environment_variable). Here's an example of all the variables you should set to override the previous example:\n\n```\nPORT=8080\nMONGO_URL='mongodb://user:pass@mongoserver/DemocracyOS-production'\nSTAFF=some@example.com,another@example.com\nCONNECTION_DATA='{\"domain\": \"127.123.123.123\", \"port\": 3412}'\nAUTH_USER='Admin'\nAUTH_PASSWORD='some-production-password'\n```\n\n* All the keys are transformed from `camelCase` to `CONSTANT_CASE`.\n* Nested values, just add a `_`, for example from `auth.user` as `AUTH_USER`.\n* `Array`s should be divided by commas `,`\n* And JSON values are a JSON string.\n\n## DOS Config Options\n\nYou can only configure the default location of your `config` folder setting the environment variable `CONFIG_PATH`, e.g: `CONFIG_PATH=/usr/src/config`. On that folder it will look for the `defaults.json` and optionally for the `{NODE_ENV}.json`.\n\nIf you want something more flexible, just use https://github.com/DemocracyOS/config\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemocracyos%2Fdos-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemocracyos%2Fdos-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemocracyos%2Fdos-config/lists"}