{"id":17159166,"url":"https://github.com/scull7/reason-nconf","last_synced_at":"2025-03-24T14:45:18.215Z","repository":{"id":57348975,"uuid":"118045564","full_name":"scull7/reason-nconf","owner":"scull7","description":"ReasonML bindings to the nconf library.","archived":false,"fork":false,"pushed_at":"2018-07-27T23:29:20.000Z","size":110,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-28T02:03:28.399Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"OCaml","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/scull7.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-01-18T22:25:24.000Z","updated_at":"2018-07-27T23:29:22.000Z","dependencies_parsed_at":"2022-09-17T22:21:46.943Z","dependency_job_id":null,"html_url":"https://github.com/scull7/reason-nconf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Freason-nconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Freason-nconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Freason-nconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Freason-nconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scull7","download_url":"https://codeload.github.com/scull7/reason-nconf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245294711,"owners_count":20591898,"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-10-14T22:13:31.037Z","updated_at":"2025-03-24T14:45:18.179Z","avatar_url":"https://github.com/scull7.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM](https://nodei.co/npm/reason-nconf.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/reason-nconf/)\n[![Build Status](https://www.travis-ci.org/scull7/reason-nconf.svg?branch=master)](https://www.travis-ci.org/scull7/reason-nconf)\n[![Coverage Status](https://coveralls.io/repos/github/scull7/reason-nconf/badge.svg?branch=master)](https://coveralls.io/github/scull7/reason-nconf?branch=master)\n\n# reason-nconf\nReasonML bindings to the [nconf][node-nconf] library.\n\nThis is a very rough implementation that will enable very simple use cases.\n\n## Usage\n```reason\ntype config = {\n  ..\n  \"THING1\": string,\n  \"THING2\": int\n};\n\nlet baseDir = \"/path/to/somewhere\"\nlet appConfig: config =\n  Nconf.(\n    make()\n    |\u003e argv()\n    |\u003e env()\n    |\u003e filePathNamed(\"locals\", {j|$baseDir/config/locals.json|j})\n    |\u003e filePathNamed(\"defaults\", {j|$baseDir/config/defaults.json|j})\n    |\u003e get()\n  );\n```\n\n### Load a JavaScript file\nThis is accomplished from an internal module written in ReasonML.  The internal\nmodule is a near 1-to-1 copy of [nconf-js]\n```reason\nlet appConfig =\n  Nconf.(\n    make()\n    |\u003e jsFilePathNamed(\"example\", {j|/path/to/file.js|j})\n    |\u003e get()\n  );\n```\n\n### Set a value\n#### String Literal\n```reason\nlet appConfig =\n  Nconf.(\n    make()\n    |\u003e setLiteral(\"some:key:path\", `Str(\"foo\"))\n    |\u003e get()\n  )\n```\n#### Integer Literal\n```reason\nlet appConfig =\n  Nconf.(\n    make()\n    |\u003e setLiteral(\"some:key:path\", `Int(42))\n    |\u003e get()\n  )\n```\n#### Object Literal\n```reason\nlet appConfig =\n  Nconf.(\n    make()\n    |\u003e setObject(\"some:key:path\", { \"foo\": \"bar\" })\n    |\u003e get()\n  )\n```\n\n### Get a value\n```reason\nlet appConfig =\n  Nconf.(\n    make()\n    |\u003e jsFilePathNamed(\"example\", {j|./__tests__/assets/data.js|j})\n  )\nlet username =\n  switch(Nconf.getKey(appConfig, \"obj:auth:username\") |\u003e Js.Nullable.to_opt) {\n  | None =\u003e Js.Exn.raiseError(\"Could not retrieve username\")\n  | Some(x) =\u003e x\n  };\n```\n\n\n## How do I install it?\n\nInside of a BuckleScript project:\n```shell\nyarn install --save reason-nconf\n```\n\nThen add `reason-nconf` to your `bs-dependencies` in `bsconfig.json`:\n```json\n{\n  \"bs-dependencies\": [\n    \"reason-nconf\"\n  ]\n}\n```\n\n## How do I use it?\n\nSee the [Usage](#usage) section above...\n\n## What's missing?\n\nMostly everything...\n\n[node-nconf]: https://www.npmjs.com/package/nconf\n[nconf-js]: https://github.com/yoneal/nconf-js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscull7%2Freason-nconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscull7%2Freason-nconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscull7%2Freason-nconf/lists"}