{"id":15297095,"url":"https://github.com/french-exception/node-config-lib","last_synced_at":"2026-02-27T04:30:50.965Z","repository":{"id":42950956,"uuid":"233267120","full_name":"French-Exception/node-config-lib","owner":"French-Exception","description":"Configuration Library","archived":false,"fork":false,"pushed_at":"2023-01-06T02:25:27.000Z","size":619,"stargazers_count":0,"open_issues_count":16,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-07-04T14:56:02.689Z","etag":null,"topics":["config","library","nodejs"],"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}},"created_at":"2020-01-11T17:08:10.000Z","updated_at":"2020-12-11T13:48:03.000Z","dependencies_parsed_at":"2023-02-05T03:01:24.197Z","dependency_job_id":null,"html_url":"https://github.com/French-Exception/node-config-lib","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/French-Exception/node-config-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/French-Exception","download_url":"https://codeload.github.com/French-Exception/node-config-lib/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/French-Exception%2Fnode-config-lib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267141147,"owners_count":24041982,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","library","nodejs"],"created_at":"2024-09-30T19:15:08.523Z","updated_at":"2025-10-27T09:37:00.941Z","avatar_url":"https://github.com/French-Exception.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/%40frenchex%2Fconfig-lib.svg)](https://badge.fury.io/js/%40frenchex%2Fconfig-lib)\n\n# About\n\nConfiguration Library is inspired by ```service-container2``` and ```Symfony Dependency Injection Container```\n\nPurpose here is not to provide a full feature mapping from both libs.\n\n# Installation\n\n```bash\nnpm i --save @frenchex/config-lib\n```\n\n# Usage\n\n## Basic JSON file structure \n\n```typescript\nexport interface ConfigurationDeclarationInterface {\n    imports?: Array\u003cstring\u003e\n    ns?: string\n    $: object\n}\n```\n\nExample :\n```\n{\n  \"imports\": [\"config_%env%.json\"],\n  \"ns\": \"example\",\n  \"$\": {\n    \"foo\": {\n      \"bar\": \"foobar\",\n      \"foobar\": \"%foo.bar%%foo.bar%\"\n    }\n  }\n}\n\n```\n\n## Loading from File\n\n```typescript\nconst loader = new ConfigurationLoader();\nconst request = (() =\u003e {\n    const requestBuilder = new ConfigurationLoaderFromFileRequestBuilder();\n\n    requestBuilder\n        .withFile(path.normalize(path.join(__dirname, '..', '..', 'test-res', 'js.js')))\n        .withRoot(path.normalize(path.join(__dirname, '..', '..', 'test-res')))\n        .withEnv({env: 'dev'})\n\n    return requestBuilder.build();\n})();\n\nconst config: ConfigurationInterface = await loader.fromFile(request);\nconst foobar : string = await config.get\u003cstring\u003e('foo.bar'); // return Maybe.just('foobar');\n```\n\n\n# Usages examples (from tests)\n\n## Usage 1\n```typescript\nconst c = new Configuration({\n    $: {\n        foo: {\n            bar: 'foobar',\n            foobar: '%foo.bar%%foo.bar%'\n        }\n    }\n});\n\nconst foobar = await c.get\u003cstring\u003e('foo.bar');\nconst foobar2 = await c.get\u003cstring\u003e('foo.foobar');\nconst foo = await c.get\u003cobject\u003e('foo');\n\nexpect(foobar).to.be.equal('foobar');\nexpect(foobar2).to.be.equal('foobarfoobar');\nexpect(foo).to.be.deep.equal({bar: 'foobar', foobar: 'foobarfoobar'});\n```\n\n## Usage 2\n\n```typescript\n const loader = new ConfigurationLoader();\n\nconst request = await (async () =\u003e {\n    const requestBuilder = new ConfigurationLoaderFromFileRequestBuilder();\n\n    requestBuilder\n        .withFile(path.normalize(path.join(__dirname, '..', '..', 'test-res', 'js.js')))\n        .withRoot(path.normalize(path.join(__dirname, '..', '..', 'test-res')))\n        .withEnv({env: 'dev'})\n\n    const request = await requestBuilder.build();\n\n    return request;\n})();\n\nconst config: ConfigurationInterface = await loader.fromFile(request);\n\nconst foobar = await config.get\u003cstring\u003e('foo.bar');\nconst foobar2 = await config.get\u003cstring\u003e('foo.foobar');\nconst foo = await config.get\u003cobject\u003e('foo');\nconst promise = await config.get\u003cobject\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrench-exception%2Fnode-config-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrench-exception%2Fnode-config-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrench-exception%2Fnode-config-lib/lists"}