{"id":24529281,"url":"https://github.com/opencomponents/oc-hobknob","last_synced_at":"2025-03-15T17:46:14.065Z","repository":{"id":57313216,"uuid":"59287865","full_name":"opencomponents/oc-hobknob","owner":"opencomponents","description":"OpenComponents hobknob plugin","archived":false,"fork":false,"pushed_at":"2020-04-30T21:45:46.000Z","size":28,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-04-14T07:49:32.999Z","etag":null,"topics":["hobknob","oc-plugin","opencomponents"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/opencomponents.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":"2016-05-20T11:04:17.000Z","updated_at":"2018-06-11T16:12:00.000Z","dependencies_parsed_at":"2022-09-20T23:30:40.221Z","dependency_job_id":null,"html_url":"https://github.com/opencomponents/oc-hobknob","commit_stats":null,"previous_names":["opentable/oc-hobknob"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-hobknob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-hobknob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-hobknob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Foc-hobknob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opencomponents","download_url":"https://codeload.github.com/opencomponents/oc-hobknob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243769949,"owners_count":20345215,"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":["hobknob","oc-plugin","opencomponents"],"created_at":"2025-01-22T07:35:44.363Z","updated_at":"2025-03-15T17:46:14.040Z","avatar_url":"https://github.com/opencomponents.png","language":"JavaScript","readme":"oc-hobknob [![Build Status](https://secure.travis-ci.org/opencomponents/oc-hobknob.png?branch=master)](http://travis-ci.org/opencomponents/oc-hobknob)\n==========\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/opencomponents/oc-hobknob.svg)](https://greenkeeper.io/)\n\n[OpenComponents](https://github.com/opentable/oc) plugin for interacting with [Hobknob](https://github.com/opentable/hobknob) toggles inside OC components.\n\n# Requirements:\n\n* Node version: min: **4**\n* OC registry\n* Hobknob server\n\n### Install\n\n```js\nnpm i oc-hobknob --save\n```\n\n### Registry setup\n\nMore info about integrating OC plugins: [here](https://github.com/opentable/oc/wiki/Registry#plugins)\n\n```js\n...\nconst registry = oc.registry(configuration);\n\nregistry.register({\n  name: 'getToggle',\n  register: require('oc-hobknob'),\n  options: {\n    host: 'hobknob-etcd.hosts.com',\n    errorHandler: (err) =\u003e {\n      console.log(err);\n    }\n  }\n}, (err) =\u003e {\n  if(err){\n    console.log('plugin initialisation failed:', err);\n  } else {\n    console.log('hobknob now available');\n  }\n});\n\n...\n\nregistry.start(callback);\n```\n\n### Using it inside components\n\nExample for a component's server.js:\n\n```js\n\nmodule.exports.data = (context, callback) =\u003e {\n  callback(null, {\n    showSomething: context.plugins.getToggle('myApp', 'toggleName', false)\n  });\n};\n```\n\n### API\n\n#### Api for plugin setup:\n\n|parameter|type|mandatory|description|\n|---------|----|---------|-----------|\n|errorHandler|`function`|no|The error handler|\n|host|`string`|yes|The hobknob etcd host|\n|port|`number`|no|Default 4001, the etcd port|\n|syncInterval|`number` (ms)|no|Default 30000, time for the internal cache to refresh|\n\n#### Api for plugin usage:\n\nThe plugin name is declared when initialising a plugin. Following assumes `getToggle` is the designated name.\n\n##### context.plugins.getToggle(serviceName, toggleName)\n\nSyncronous function that gets a value for a given Service name and toggle. Default for when hobknob doesn't have the value is `false`.\n\n##### context.plugins.getToggle(serviceName, toggleName, defaultValue)\n\nSyncronous function that gets a value for a given Service name and toggle. Default for when hobknob doesn't have the value is `false`.\n\n##### context.plugins.getToggle(serviceName, toggleName, secondaryToggleKey, defaultValue)\n\nSyncronous function that gets an Hobknob toggle value for a given serviceName and toggleName and secondaryToggleKey using specified default value. \n\n# Contributing\n\nYes please. Open an issue first.\n\n### License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencomponents%2Foc-hobknob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencomponents%2Foc-hobknob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencomponents%2Foc-hobknob/lists"}