{"id":20434592,"url":"https://github.com/arstgit/ya-config-loader","last_synced_at":"2025-03-05T06:26:04.214Z","repository":{"id":57402720,"uuid":"234924780","full_name":"arstgit/ya-config-loader","owner":"arstgit","description":"JSON config loader.","archived":false,"fork":false,"pushed_at":"2020-01-24T13:36:24.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T23:36:29.813Z","etag":null,"topics":[],"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/arstgit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-01-19T15:53:21.000Z","updated_at":"2020-01-24T13:36:26.000Z","dependencies_parsed_at":"2022-09-08T03:11:04.403Z","dependency_job_id":null,"html_url":"https://github.com/arstgit/ya-config-loader","commit_stats":null,"previous_names":["derekchuank/ya-config-loader"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arstgit%2Fya-config-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arstgit%2Fya-config-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arstgit%2Fya-config-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arstgit%2Fya-config-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arstgit","download_url":"https://codeload.github.com/arstgit/ya-config-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241549089,"owners_count":19980475,"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-15T08:27:48.033Z","updated_at":"2025-03-05T06:26:04.187Z","avatar_url":"https://github.com/arstgit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ya-config-loader\n\n[![Build Status](https://travis-ci.org/derekchuank/ya-config-loader.svg?branch=master)](https://travis-ci.org/derekchuank/ya-config-loader)\n[![npm version](https://badge.fury.io/js/ya-config-loader.svg)](http://badge.fury.io/js/ya-config-loader)\n\n## Super simple to use\n\nA simple config loader, support `json` only.\n\n## Installation\n\n```\nnpm install ya-config-loader\n```\n\n## Usage\n\nUsually, you will create a `config` directory including `default.json`, `test.json` and `production.json` in your project root directory. And using `NODE_ENV=test` to overwrite(merge) `default.json` with `test.json` is very helpful. Specifing environment variables such as `PORT=3000` can also be used to overwrite with highest priority.\n\nFirst, Invoking the module without params to load the `config` in `process current working dir` is necessary:\n\n```js\nrequire(\"ya-config-loader\").load();\nconst config = require(\"ya-config-loader\");\n```\n\nor\n\n```js\nconst config = require(\"ya-config-loader\").load();\n```\n\nAlternatively, invoking with path string can be used to overwrite(merge) the `config` of `process current working dir`:\n\n```js\nrequire(\"ya-config-loader\").load(\"path/to/config\");\nconst config = require(\"ya-config-loader\");\n```\n\nor\n\n```js\nconst config = require(\"ya-config-loader\").load(\"path/to/config\");\n```\n\nAfter step 1, `require(\"ya-config-loader\")` will become one `global` plain javascript object with only configs entries in it. When you need it:\n\n```js\nconst config = require(\"ya-config-loader\");\n```\n\nAnd you can modify this plain object freely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farstgit%2Fya-config-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farstgit%2Fya-config-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farstgit%2Fya-config-loader/lists"}