{"id":23174245,"url":"https://github.com/coursedesign/config-importer","last_synced_at":"2025-08-18T09:30:57.217Z","repository":{"id":40400877,"uuid":"220907723","full_name":"CourseDesign/config-importer","owner":"CourseDesign","description":"Developers can manage environment variables in various stages, such as production, test, development, etc.","archived":false,"fork":false,"pushed_at":"2023-06-19T20:58:02.000Z","size":22,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-28T20:49:05.687Z","etag":null,"topics":["config","config-management","configuration","configuration-management"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@araxsiyual/config-importer","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/CourseDesign.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":"2019-11-11T05:29:39.000Z","updated_at":"2021-05-07T01:45:07.000Z","dependencies_parsed_at":"2022-08-09T19:20:56.862Z","dependency_job_id":null,"html_url":"https://github.com/CourseDesign/config-importer","commit_stats":null,"previous_names":["kdpark0723/config-importer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconfig-importer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconfig-importer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconfig-importer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CourseDesign%2Fconfig-importer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CourseDesign","download_url":"https://codeload.github.com/CourseDesign/config-importer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230220158,"owners_count":18192228,"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":["config","config-management","configuration","configuration-management"],"created_at":"2024-12-18T05:19:41.105Z","updated_at":"2024-12-18T05:19:41.796Z","avatar_url":"https://github.com/CourseDesign.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Config Importer ![](https://img.shields.io/npm/dm/@araxsiyual/config-importer.png?style=flat-square)\n\n​\tDevelopers can manage environment variables in various stages, such as production, test, development, etc.  Developers can set default status by option or NODE_ENV. if you not set default status, it will be development  Environment variables are created in the common.js and `yourEnvironmentStatus`.js  However, if an environment variable is declared in an .env file or a system environment variable, that value takes precedence.\n\n\n\n## How to use\n\n```javascript\nconst configImporter = require('@araxsiyual/config-importer');\n\nconst config = configImporter.import(__dirname, /*option*/);\n```\n\n\n\n## Option\n\n```javascript\n{\n    \"env\";:  process.env.NODE_ENV || \"development\",\n    \"valueName\";: \"valueName\",\n    \"default\";: \"common\"\n}\n```\n\n- `env`: Environment status, it will read `env`.js file, and make config\n- `valueName`: If object have `valueName`, module use `valueName`'s value for read System value or .env, If the object does not have a `valueName`, module use object name for read System value or .env\n- `default`: default environment file name\n\n\n\n## Example\n\n### Import the right environment variable\n\n#### common.js\n\n```javascript\nmodule.exports = {\n    parent: {\n        childA: 0,\n        childB: 0\n    }\n}\n```\n\n#### development.js\n\n```javascript\nmodule.exports = {\n    parent: {\n        childA: 1\n    }\n}\n```\n\n####  test.js\n\n```javascript\nmodule.exports = {\n    parent: {\n        childA: 2\n    }\n}\n```\n\n#### index.js\n\n```javascript\nconst configImporter = require('@araxsiyual/config-importer');\n\nconst config = configImporter.import(__dirname);\n\nmodule.exports = config;\n```\n\n#### If development status is `development`\n\n- **config is**\n\n  ```javascript\n  {\n      {\n          1,\n          childB;: 0\n      }\n  }\n  ```\n\n#### If development status is `test`\n\n- **config is**\n\n  ```javascript\n  {\n      {\n          2,\n          childB;: 0\n      }\n  }\n  ```\n\n\n\n### .env file variable name\n\n#### common.js\n\n```javascript\nmodule.exports = {\n    parent: {\n        childA: 0\n    }\n}\n```\n\n#### .env\n\n```\nPARENT_CHILD_A = 1\n```\n\n- parent.childA will be 1\n\n\n\n#### if development status is `development`\n\n#### .env\n\n```\nPARENT_CHILD_A = 1\nPARENT_CHILD_A_DEVELOPMENT = 2\n```\n\n- parent.childA will be 2\n\n\n\n### Set value name\n\n#### common.js\n\n```javascript\nmodule.exports = {\n    parent: {\n        valueName: 'p',\n        childA: 0\n    }\n}\n```\n\n#### .env\n\n```\nP_CHILD_A = 1\n```\n\n- parent.childA will be 1\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoursedesign%2Fconfig-importer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoursedesign%2Fconfig-importer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoursedesign%2Fconfig-importer/lists"}