{"id":16255295,"url":"https://github.com/qubyte/configeur","last_synced_at":"2025-03-19T21:30:41.089Z","repository":{"id":52189062,"uuid":"77901785","full_name":"qubyte/configeur","owner":"qubyte","description":"Extensible parsing of environment variables into config for Node.js.","archived":false,"fork":false,"pushed_at":"2021-05-05T21:21:13.000Z","size":455,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T23:21:18.723Z","etag":null,"topics":["12-factor","config","environment"],"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/qubyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-03T09:17:33.000Z","updated_at":"2022-04-21T07:41:45.000Z","dependencies_parsed_at":"2022-08-27T14:47:27.996Z","dependency_job_id":null,"html_url":"https://github.com/qubyte/configeur","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubyte%2Fconfigeur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubyte%2Fconfigeur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubyte%2Fconfigeur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubyte%2Fconfigeur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qubyte","download_url":"https://codeload.github.com/qubyte/configeur/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056406,"owners_count":20390719,"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":["12-factor","config","environment"],"created_at":"2024-10-10T15:29:21.419Z","updated_at":"2025-03-19T21:30:40.557Z","avatar_url":"https://github.com/qubyte.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# configeur\n\nThis module is inspired by and borrows much of its behaviour from the excellent\nKonfiga module. This module removes the commandline parsing abilities of its\nancestor, adds required variables, and simplifies some internal logic around\ncustom parsers by slightly altering that part of the options API.\n\nconfigeur reads in the environment and uses a spec to parse and the values\nfound to appropriate types. It supports:\n\n - Type casting, with some types parsers included and API to add or replace\n   parsers.\n - Default values when environment variables should be optional.\n - Required values when environment variables are not optional.\n\n### Usage\n\nConfigeur accepts an object which defines config variables names and how to\nderive them from the environment (or a default). Import as an ES module.\n\nFor example:\n\n```js\n// Module config.js\n\nimport configeur from 'configeur';\n\nexport default configeur({\n  PORT: {\n    defaultValue: '8000',\n    type: 'number'\n  }\n});\n```\n\nThe above, assuming no values are read from the environment, will assign to\nconfig.js as a default export:\n\n```javascript\n{\n  PORT: 8000\n}\n```\n\nFields used to configure a config variable are:\n\n| field               | required | description |\n| ------------------- | -------- | ----------- |\n| `'defaultValue'`    | `false`  | The value used when the variable is not found in the environment. Must always be a string, as if it has come from the environment. |\n| `'required'`        | `false`  | Defaults to false. When true, a corresponding environment variable is required. A default will be ignored and an error thrown when the environment variable is not found.\n| `'type'`            | `false`  | The type to cast to. Defaults to `'string'`.\n\nDefault types are:\n\n* `'string'`\n* `'number'`\n* `'boolean'`\n\nAdditional types can be specified as parsers.\n\n### Options\n\nconfigeur accepts a second parameter consisting of an options object.\n\n#### `parsers`\n\nconfigeur comes with default parsers. To add more parsers, or override\nexisting parsers, this array can be used. For example, to add an `'integer'`\ntype:\n\n```js\nconst config = configeur(schema, {\n  parsers: [\n    ['integer', value =\u003e parseInt(value, 10)]\n  ]\n});\n```\n\n#### `mutable`\n\nBy default, the object returned by configuer is frozen. Since it is also flat,\nthe object is completely immutable. The `mutable` option makes configeur return\nan unfrozen object. This is not recommended in general, but may be useful for\ntesting purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubyte%2Fconfigeur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqubyte%2Fconfigeur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubyte%2Fconfigeur/lists"}