{"id":22273098,"url":"https://github.com/mac-/configurine-picker","last_synced_at":"2025-03-25T16:27:01.209Z","repository":{"id":13424009,"uuid":"16112722","full_name":"mac-/configurine-picker","owner":"mac-","description":"Logic for picking config values based on a given app name, app version, and environment name","archived":false,"fork":false,"pushed_at":"2014-03-10T19:53:24.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T06:41:11.663Z","etag":null,"topics":[],"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/mac-.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":"2014-01-21T18:06:56.000Z","updated_at":"2014-03-10T19:53:24.000Z","dependencies_parsed_at":"2022-09-26T19:13:32.240Z","dependency_job_id":null,"html_url":"https://github.com/mac-/configurine-picker","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fconfigurine-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fconfigurine-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fconfigurine-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fconfigurine-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mac-","download_url":"https://codeload.github.com/mac-/configurine-picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245498970,"owners_count":20625279,"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-12-03T13:09:45.401Z","updated_at":"2025-03-25T16:27:01.184Z","avatar_url":"https://github.com/mac-.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"configurine-picker\n==================\n\nLogic for picking config values based on a given app name, app version, and environment name from Configurine\n\n[![Build Status](https://secure.travis-ci.org/mac-/configurine-picker.png)](http://travis-ci.org/mac-/configurine-picker)\n[![Coverage Status](https://coveralls.io/repos/mac-/configurine-picker/badge.png)](https://coveralls.io/r/mac-/configurine-picker)\n[![NPM version](https://badge.fury.io/js/configurine-picker.png)](http://badge.fury.io/js/configurine-picker)\n[![Dependency Status](https://david-dm.org/mac-/configurine-picker.png)](https://david-dm.org/mac-/configurine-picker)\n\n[![NPM](https://nodei.co/npm/configurine-picker.png?downloads=true\u0026stars=true)](https://nodei.co/npm/configurine-picker/)\n\n## Installation\n\nYou may depend on the module by putting an entry in the dependencies section of your package.json file with the appropriate version:\n\n\t\"configurine-picker\": \"0.x.x\"\n\nYou may also use npm to install the module and have it saved to your package.json using:\n\n\tnpm install configurine-picker --save\n\n## Usage\n\nThis module takes a set of config entries and filters them down to one of each name by picking the one whose associations best match the given application and environment using the following priority:\n\n* has both the matching app and env association\n* has one of a matching app or env association (app or env may have a higher priority based on app settings (associationPriority))\n* has no matching app or env associations\n\nThe function exported by this module takes one `options` paramter and returns an object that contains the names provided and the corresponding values that were picked. The expected properties on the `options` object are:\n\n* `appName` - the name of the application to match on (required)\n* `appVersion` - the version of the application to match on (required)\n* `environmentName` - the name of the environment to match on (required)\n* `names` - an array of strings that represent the names of the config entries pick for\n* `associationPriority` - tells the picker which association to give priority to: 'app' or 'env'. Defaults to 'app'\n* `entries` - the collection of config entries from configurine to pick from (required)\n\nExample:\n\n```javascript\nvar picker = require('configurine-picker');\n\n// example set of config entries from configurine for demo purposes\nvar entries = [\n\t{\n\t\tname: 'foo',\n\t\tvalue: 'bar',\n\t\tassociations: {\n\t\t\tapplications: [{\n\t\t\t\tname: 'my-app',\n\t\t\t\tversions: ['1.0.0']\n\t\t\t}],\n\t\t\tenvironments: []\n\t\t},\n\t\tisActive: true,\n\t\tisSensitive: false,\n\t\towner: 'me'\n\t},\n\t{\n\t\tname: 'foo',\n\t\tvalue: 'baz',\n\t\tassociations: {\n\t\t\tapplications: [],\n\t\t\tenvironments: ['production']\n\t\t},\n\t\tisActive: true,\n\t\tisSensitive: false,\n\t\towner: 'me'\n\t}\n];\n\nvar config = picker({\n\tnames: ['foo'],\n\tappName: 'my-app',\n\tappVersion: '1.0.0',\n\tenvironmentName: 'production',\n\tassociationPriority: 'app',\n\tentries: entries\n});\n\nconsole.log(config.foo); // 'bar'\n\n\nconfig = picker({\n\tnames: ['foo', 'other'],\n\tappName: 'my-app',\n\tappVersion: '1.0.0',\n\tenvironmentName: 'production',\n\tassociationPriority: 'env',\n\tentries: entries\n});\n\nconsole.log(config.foo); // 'baz'\nconsole.log(config.other); // undefined\n```\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mac-/configurine-picker/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-%2Fconfigurine-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmac-%2Fconfigurine-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-%2Fconfigurine-picker/lists"}