{"id":19197878,"url":"https://github.com/flarebyte/confiture","last_synced_at":"2026-05-14T22:32:46.417Z","repository":{"id":30559549,"uuid":"34114367","full_name":"flarebyte/confiture","owner":"flarebyte","description":"Configuration library supporting json-schema","archived":false,"fork":false,"pushed_at":"2023-01-04T23:38:27.000Z","size":1080,"stargazers_count":0,"open_issues_count":29,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T14:17:14.239Z","etag":null,"topics":["npm-package"],"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/flarebyte.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":"2015-04-17T12:05:05.000Z","updated_at":"2023-05-13T06:54:25.000Z","dependencies_parsed_at":"2023-01-14T17:12:47.103Z","dependency_job_id":null,"html_url":"https://github.com/flarebyte/confiture","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fconfiture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fconfiture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fconfiture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flarebyte%2Fconfiture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flarebyte","download_url":"https://codeload.github.com/flarebyte/confiture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271539,"owners_count":19774859,"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":["npm-package"],"created_at":"2024-11-09T12:19:05.195Z","updated_at":"2026-05-14T22:32:46.368Z","avatar_url":"https://github.com/flarebyte.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image]\n\n\u003e Configuration library with validation using json-schema, compression, and encryption\n\nThe main goal of confiture is to provide configuration with:\n\n * systematic validation using JSON schema.\n * the option to compress the configuration file.\n * the option to encrypt the configuration file.\n\n\n Optionally, the configuration could be manipulated from a CLI using commander and [json commander. ](https://github.com/flarebyte/json-commander)\n\nVersion V2.x has been migrated from Javascript to Typescript.\n\n## Install\n\n```sh\n$ npm install --save confiture\n```\n\n\n## Usage\n\n### Synchronously load some JSON\n\n```js\nvar confiture = require('confiture');\n\nvar configurator = confiture({\n    name: \"conf\",\n    schema: __dirname + \"/schemas/conf.schema.json\",\n    baseDirectory: __dirname,\n    relativeDirectory: \"appname\"\n});\n\nvar conf = configurator.load();\n//Will load __dirname/appname/conf.json\n//conf will contain the configuration data\n//or an Error object if the validation has failed.\n\n```\n\n### Asynchronously save some JSON through a stream\n\n```js\nvar confiture = require('confiture');\n\nvar configurator = confiture({\n    name: \"conf\",\n    schema: __dirname + \"/schemas/conf.schema.json\",\n    baseDirectory: __dirname,\n    relativeDirectory: \"appname\"\n});\n\nvar conf = {\n\t\"email\": \"support@mycompany.com\",\n\t\"project\": \"bestProject\"\n};\n\nvar stream = configurator.save(conf);\n//Will save the configuration in __dirname/appname/conf.json\n//and return a stream\n//or an Error object if the validation has failed.\n```\n### Synchronously save some JSON\n\n```js\nvar confiture = require('confiture');\n\nvar configurator = confiture({\n    name: \"conf\",\n    schema: __dirname + \"/schemas/conf.schema.json\",\n    baseDirectory: __dirname,\n    relativeDirectory: \"appname\"\n});\n\nvar conf = {\n\t\"email\": \"support@mycompany.com\",\n\t\"project\": \"bestProject\"\n};\n\nvar saveResult = configurator.saveSync(conf);\n//Will save the configuration in __dirname/appname/conf.json\n//and return OK\n//or an Error object if the validation has failed.\n```\n\n### Compression\n\nYou can ask for the json file to be compressed.\nOnly gz is supported at the moment.\n\n```js\n\nvar configurator = confiture({\n    name: \"conf\",\n    schema: __dirname + \"/schemas/conf.schema.json\",\n    baseDirectory: __dirname,\n    relativeDirectory: \"appname\"\n    compression: \"gz\"\n});\n\n//The generated file name will be __dirname/appname/conf.json.gz\n\n```\n\n### Encryption\n\nYou can ask for the json file to be encrypted.\nWhen encryption is on, compression is not supported though.\n\nMost ciphers should be supported. You can check the list by typing:\n\n```js\nrequire('crypto').getCiphers();\n```\n\nEncrypted configuration:\n\n```js\n\nvar configurator = confiture({\n    name: \"conf\",\n    schema: __dirname + \"/schemas/conf.schema.json\",\n    baseDirectory: __dirname,\n    relativeDirectory: \"appname\"\n    encryption: \"aes-256-cbc\",\n    password: \"my secure password\"\n});\n\n//The generated file name will be __dirname/appname/conf.json.aes-256-cbc\n\n```\n\n### Backup\n\nYou can ask for the json file to be backed up before saving a new configuration.\n\n```js\n\nvar configurator = confiture({\n    name: \"conf\",\n    schema: __dirname + \"/schemas/conf.schema.json\",\n    baseDirectory: __dirname,\n    relativeDirectory: \"appname\"\n    backupBeforeSave: true\n\n});\n\n//The backup file name will be something like __dirname/appname/conf.json.bak-2015-05-02T17:44:25+01:00\n\n```\n\n### Understanding the configuration\n\nYou can have an insight about the configuration by logging this:\n\n```js\n\nconsole.log(configurator.configuration());\n\n```\n\n\n## License\n\nMIT © [Olivier Huin]()\n\n\n[npm-url]: https://npmjs.org/package/confiture\n[npm-image]: https://badge.fury.io/js/confiture.svg\n[travis-url]: https://travis-ci.org/flarebyte/confiture\n[travis-image]: https://travis-ci.org/flarebyte/confiture.svg?branch=master\n[daviddm-url]: https://david-dm.org/flarebyte/confiture.svg?theme=shields.io\n[daviddm-image]: https://david-dm.org/flarebyte/confiture\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarebyte%2Fconfiture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflarebyte%2Fconfiture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflarebyte%2Fconfiture/lists"}