{"id":22202902,"url":"https://github.com/french-exception/node-config-api","last_synced_at":"2025-03-25T01:47:40.791Z","repository":{"id":42941514,"uuid":"234797768","full_name":"French-Exception/node-config-api","owner":"French-Exception","description":"Configuration API","archived":false,"fork":false,"pushed_at":"2023-03-04T05:44:12.000Z","size":386,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-03-17T22:59:43.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/French-Exception.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}},"created_at":"2020-01-18T21:06:17.000Z","updated_at":"2020-12-11T14:18:53.000Z","dependencies_parsed_at":"2024-12-02T16:53:41.918Z","dependency_job_id":null,"html_url":"https://github.com/French-Exception/node-config-api","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.30000000000000004","last_synced_commit":"361d817f2404318e68a147283ffa18c9d7c4a68d"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/French-Exception","download_url":"https://codeload.github.com/French-Exception/node-config-api/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245383120,"owners_count":20606265,"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-12-02T16:38:50.065Z","updated_at":"2025-03-25T01:47:40.770Z","avatar_url":"https://github.com/French-Exception.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nConfiguration API let you use Configuration Lib with your own code.\n\nIt helps create and load User-scoped, Global-scoped and Directory-scoped Configuration files.\n\nConfiguration files can be ```.json``` or ```.js``` files returning plain JSON or \n\n# Installation\n\n```bash\nnpm i --save @frenchex/config-api\n```\n\n# Usage \n## From File\nExample loading from file (from tests) :\n```typescript\nimport * as api from \"@frenchex/config-api\"\n\nconst config = await api.fromFile({\n    env: {env: 'dev'},\n    file: path.join(testResourcesRootPath, 'js.js'),\n    root: testResourcesRootPath\n})\n\nconst foobar = await config.get\u003cstring\u003e('foo.bar');\nconst foobar2 = await config.get\u003cstring\u003e('foo.foobar');\nconst foo = await config.get\u003c{ bar: string, foobar: string }\u003e('foo');\nconst promise = await config.get\u003cstring\u003e('promise');\n\nexpect(foobar).to.be.equal('foobar');\nexpect(foobar2).to.be.equal('foobarfoobar');\nexpect(foo).to.be.deep.equal({bar: 'foobar', foobar: 'foobarfoobar'});\nexpect(promise).to.be.deep.equal('resolved');\n```\n\n## From JS object\nExample loading config from object (from tests):\n```typescript\n\nconst config = await api.fromDeclaration({\n    $: {\n        foo: {\n            bar: 'foobar'\n        }\n    }\n})\n\nconst bar = await config.get\u003cstring\u003e('foo.bar');\nexpect(bar).to.be.equal('foobar');\n```\n\n\n## From File \u0026 JS object\n\nYou can also do both\n\n````typescript\nconst config = await api.fromFile({\n    env: {env: 'dev'},\n    file: path.join(testResourcesRootPath, 'js.js'),\n    root: testResourcesRootPath,\n    $: {\n        \"imports\": ['my_file_%env%.json'],  \n    }\n})\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrench-exception%2Fnode-config-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrench-exception%2Fnode-config-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrench-exception%2Fnode-config-api/lists"}