{"id":28249976,"url":"https://github.com/eidellev/magiconfig","last_synced_at":"2026-04-29T09:04:36.154Z","repository":{"id":104930952,"uuid":"69381005","full_name":"eidellev/magiconfig","owner":"eidellev","description":"Yet another Node.js config utility :-)","archived":false,"fork":false,"pushed_at":"2016-11-25T18:35:56.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T13:14:00.467Z","etag":null,"topics":["config","environment","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eidellev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2016-09-27T17:20:46.000Z","updated_at":"2023-09-03T15:17:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3cd1a2f-1686-475e-bc7e-94455439399a","html_url":"https://github.com/eidellev/magiconfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eidellev/magiconfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidellev%2Fmagiconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidellev%2Fmagiconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidellev%2Fmagiconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidellev%2Fmagiconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eidellev","download_url":"https://codeload.github.com/eidellev/magiconfig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidellev%2Fmagiconfig/sbom","scorecard":{"id":369773,"data":{"date":"2025-08-11","repo":{"name":"github.com/eidellev/magiconfig","commit":"3d5b4b6a1f2e49c88fdd9a3cc1474f60357589e2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:41:52.224Z","repository_id":104930952,"created_at":"2025-08-18T12:41:52.224Z","updated_at":"2025-08-18T12:41:52.224Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32418188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["config","environment","nodejs"],"created_at":"2025-05-19T13:16:15.379Z","updated_at":"2026-04-29T09:04:36.149Z","avatar_url":"https://github.com/eidellev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magiconfig\n[![npm version](https://badge.fury.io/js/magiconfig.svg)](https://badge.fury.io/js/magiconfig)\n\nThis is a tool for building app configuration based on the environment that it's run in.\nMagiconfig does the work of validating your config for you and is flexible enough to allow you as little or as much control over it as you would like.\u003cbr\u003e\n\u003cstrong\u003eNote:\u003c/strong\u003e\u003cbr\u003e\nEach validation step throws an error upon failing. For instance, if you haven't set NODE_ENV you will get the following:\u003cbr\u003e\n\u003ci\u003e'NODE_ENV is not set!'\u003c/i\u003e\u003cbr\u003e\n\n### Installation\n```\nnpm i magiconfig --save\n```\n\n### Usage\n\n```javascript\nconst magiconfig = require('magiconfig')\n\nconst config = magiconfig(params)\n```\n\nMagiconfig accepts a configuration object with the following properties:\n* `envConfig` - Key-value pairs of environment names and their respective config files\n* `template` - Path to config template file\n* `mandatoryKeys` - A list of keys that require values.\n* `staticConfig` - Path to static config file\n* `doTypeValidation` - Should we validate config types against the template?\n* `validate` - Custom validation function\n\n\u003cstrong\u003eNote\u003c/strong\u003e: All paths are relative to project root.\n\n#### envConfig\nAn object with key-value pairs of environment names and their config files(can be either `.toml`, `.yml`, `.yaml`, `.json` or `.js` files). i.e.\n```javascript\n{\n    dev: '/path/to/your/file'\n    prod: '/path/to/some/other/file'\n}\n```\nYour environment is determined based on `NODE_ENV`. For instance, you can set it this way through package.json:\n```json\n...\n\"scripts\": {\n    \"run-dev\": \"NODE_ENV=dev node app.js\",\n    \"run-prod\": \"NODE_ENV=prod node app.js\"\n}\n...\n```\n\n#### template(Optional)\nUse this to validate a config file against a template file(can be either a `.toml`, `.yml`, `.yaml`, `.json` or `.js` file).\nThe template file must itself be valid and contain all the keys that you wish the config file to have, including nested keys. The values are not used anywhere, so feel free to provide sample values and comments.\n\n```toml\na = 'some string'\nb = 1 # should be a number\n\n[api]\nhostname = 'someapi.com'\nport = 1337\n...\n```\n#### staticConfig(Optional)\nOftentimes an app has static values that do not change between different environments.\nThe static config file will be merged with the environment config.\nEnvironment config parameters will override their static counterparts.\n\n#### mandatoryKeys(Optional)\nUse this to provide a list of mandatory keys(currently we only guard against empty strings).\nYou can use dot notation for nested keys (i.e. `['api.hostname']`).\nIf you wish to mark all keys as mandatory simply use `['*']`. However, if you still want to exclude some keys use the `'-'` prefix: `['*', '-api.port']`\n\n#### doTypeValidation(Optional)\n(Works in conjunction with 'template')\u003cbr\u003e\nValidate the types of properties in our config as set in the config template.\nSupported types are:\n* number\n* boolean\n* string\n* array\n* object\n* enum\n\n\u003cstrong\u003eExample\u003c/strong\u003e:\n```javascript\n// config.js\nconst config = magiconfig({\n    templateFile: 'template.toml',\n    envConfig: {\n        'prod': 'test4.toml'\n    },\n    doTypeValidation: true\n})\n```\n```toml\n    # template.toml\n    a = 'string'\n    b = 'number'\n    c = 'array'\n    d = 'object'\n    e = 'enum: abc,def,ghi'\n```\n\n```toml\n    # config.toml\n    a = 'some srting'\n    b = '123'\n    c = [1, 2, 3]\n    [d]\n    e = 'Object property'\n    f = 'Another object property'\n```\n\n#### validate (optional)\nAdditional custom validation function. Function accepts the final config and a callback:\n```javascript\n    ...\n    const fs = require('fs')\n\n    validate: (config, cb) =\u003e {\n        if (!fs.existsSync(config.path)) {\n            // Invalid config\n            return cb (new Error('Path does not exist!'))\n        }\n\n        // Valid config\n        cb()\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidellev%2Fmagiconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feidellev%2Fmagiconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidellev%2Fmagiconfig/lists"}