{"id":22770126,"url":"https://github.com/mernxl/configu","last_synced_at":"2025-06-25T03:04:42.776Z","repository":{"id":125211561,"uuid":"298946286","full_name":"mernxl/configu","owner":"mernxl","description":"A node JS env and configuration loader with typescript support. Build in support to load with respect to your environment, dev, prod, test","archived":false,"fork":false,"pushed_at":"2021-06-01T14:26:52.000Z","size":317,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-29T22:04:59.668Z","etag":null,"topics":["configuration","env","ini","process-env","properties-loader"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mernxl.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-27T03:34:05.000Z","updated_at":"2021-06-01T14:26:55.000Z","dependencies_parsed_at":"2023-07-30T07:16:28.542Z","dependency_job_id":null,"html_url":"https://github.com/mernxl/configu","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":"mernxl/template-node-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mernxl%2Fconfigu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mernxl%2Fconfigu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mernxl%2Fconfigu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mernxl%2Fconfigu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mernxl","download_url":"https://codeload.github.com/mernxl/configu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mernxl%2Fconfigu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258301704,"owners_count":22680200,"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":["configuration","env","ini","process-env","properties-loader"],"created_at":"2024-12-11T15:20:27.812Z","updated_at":"2025-06-25T03:04:42.766Z","avatar_url":"https://github.com/mernxl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# configu\n[![npm](https://img.shields.io/npm/v/@xelgrp/configu.svg)](https://www.npmjs.com/package/@xelgrp/configu)\n[![codecov](https://codecov.io/gh/mernxl/configu/branch/master/graph/badge.svg?token=CDR05VIYIX)](https://codecov.io/gh/mernxl/configu)\n[![Dependencies State](https://david-dm.org/mernxl/configu.svg)](https://david-dm.org/mernxl/configu)\n![TypeScript compatible](https://img.shields.io/badge/typescript-compatible-brightgreen.svg)\n[![Code Style Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nA node JS env and configuration loader with typescript support. Build in support to load with respect to your environment, dev, prod etc\n\n## Installation\n```\nyarn add @xelgrp/configu\nor\nnpm install @xelgrp/configu\n```\n\n### Clearer Docs TODO\nThis package currently supports loading [`properties`](https://www.npmjs.com/package/properties) files.\n\nNOTE: This library supports configuration files that must be terminated by the extensions to determine its type.\n* **.ini, .properties**: Properties files\n* **.yml, .yaml**: Yaml files (Coming Soon)\n* **.json**: Json configuration files (Coming Soon) \n\nTo load a configuration;\n```typescript\nimport { loadConfig } from '@xelgrp/configu';\n\ninterface AppConfig {\n  host: string;\n  port: string;\n  dbPass?: string;\n  dbUser: string;\n}\n\nconst defaultConfigs = {\n  host: 'localhost',\n  port: 4040,\n  dbUser: 'root'\n}\n\n// export function to use in loading later\nexport const getConfig = (): AppConfig =\u003e loadConfig\u003cAppConfig\u003e('app.ini', defaultConfigs);\n\nexport const config = getConfig();\n```\n\nThis package loads Configurations in such a way that, the previous config will serve as variables for the next,\noverride fields in next config file or will become additional fields in the configuration\n\nConsidering an `app.ini` configurations to load, variable loading takes place in the following order;\n* process.env -\u003e app.development.local.ini -\u003e app.development.ini -\u003e app.local.ini -\u003e app.ini \u0026 process.env\n* process.env -\u003e app.production.local.ini -\u003e app.production.ini -\u003e app.local.ini -\u003e app.ini \u0026 process.env\n* process.env -\u003e app.test.local.ini -\u003e app.test.ini -\u003e app.local.ini -\u003e app.ini \u0026 process.env\n\nConfiguration variables are loaded from the `app.**.ini` files in such a way as to match the current environment.\nE.g. When `NODE_ENV=development`, the `app.development.ini` files are loaded along side the `app.ini` file and \nenvironment variables. \n\nThe NODE_ENV can be changed by any file by setting the NODE_ENV variable. This NODE_ENV variable always defaults to \n`development`.\n\nprocess.env is loaded at the start to serve as variables for next configurations, it is again loaded at the end together \nwith the base file so if it was overwritten along the load chain, it will still serve as a final source of truth.\n\nUsually you would not want to commit your `.local.` files as they may contain variables that do not need committing, \nlike usernames and passwords normally you will pass them through environment variables at deployment.\n\nNOTE: All config files must be one directory\n\n### License\nThis project is MIT Licensed - see the LICENSE.md file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmernxl%2Fconfigu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmernxl%2Fconfigu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmernxl%2Fconfigu/lists"}