{"id":21053521,"url":"https://github.com/etcinit/nexus-client-js","last_synced_at":"2025-05-15T21:36:45.471Z","repository":{"id":21685551,"uuid":"25006802","full_name":"etcinit/nexus-client-js","owner":"etcinit","description":"Javascript client for the Nexus Configuration Server","archived":false,"fork":false,"pushed_at":"2014-12-09T21:38:31.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-08-04T10:11:03.464Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/etcinit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-09T20:15:25.000Z","updated_at":"2023-08-04T10:11:03.465Z","dependencies_parsed_at":"2022-08-19T22:00:17.190Z","dependency_job_id":null,"html_url":"https://github.com/etcinit/nexus-client-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etcinit%2Fnexus-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etcinit%2Fnexus-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etcinit%2Fnexus-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etcinit%2Fnexus-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/etcinit","download_url":"https://codeload.github.com/etcinit/nexus-client-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225384398,"owners_count":17465879,"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-11-19T16:07:02.087Z","updated_at":"2024-11-19T16:07:02.680Z","avatar_url":"https://github.com/etcinit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nexus Client (JS)\n\nJavascript client for the [Nexus Configuration Server](https://github.com/eduard44/nexus)\n\n## Setup\n\n1. Setup a Nexus server\n2. Require the library into your project:\n```\nnpm require --save nexus-config-js\n```\n3. Build a client and fetch configuration files for your app (Explained below)\n\n### Compatibility:\nThis current version only works with Node.js (server-side) apps.\n\n## Using the client\n\nIn order to create an instance of a client with need to provide it with two parameters:\n\n- The address of the server (HTTP or HTTPS)\n- The API that is specific to the app you are configuring\n\nThese parameters can be passed through environment variables or manually through an options object:\n\n### With environment variables\n\nThey client will look for a **NEXUS_SERVER** and **NEXUS_APIKEY** environment variables:\n\n```js\nvar NexusClient = require('nexus-client-js'),\n\n\tclientInstance;\n\t\nclientInstance = NexusClient.buildFromEnv();\n\nclientInstance.fetch(function (collection) {\n\t// Fetch configuration files here\n});\n```\n\nPlease note that this method will throw an error if the appropriate environment variables are not defined. You can check if they are present with `NexusClient.isEnvPresent()`\n\n### With manual configuration\n\n```js\nvar NexusClient = require('nexus-client-js'),\n\n\tclientInstance;\n\t\nclientInstance = NexusClient.build(\n\t'http://nexus.local',\n\t'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\n);\n\nclientInstance.fetch(function (collection) {\n\t// Fetch configuration files here\n});\n```\n\n## API\n\n### NexusClient\n- **fetch(callback)**: Fetches all the configuration files from the server and calls the callback with a ConfigurationCollection object\n- **ping(message, callback)**: Send a ping message to the server\n- **log(filename, files, callback)**: Push log lines to the server\n- **build(server, apiKey)**: Creates a new NexusClient from that uses the specified server and key (NexusClient)\n- **buildFromEnv()**: Creates a new NexusClient from evironment variables, NEXUS\\_SERVER and NEXUS\\_APIKEY (NexusClient)\n- **isEnvPresent()**: Returns a boolean indicating if NEXUS\\_SERVER and NEXUS\\_APIKEY are available (Boolean)\n\n### ConfigurationCollection\n- **getKeyAsString(key)**: Get a configuration file as a raw string (String)\n- **getKeyAsJson(key)**: Get a configuration file as a JSON object (Object)\n- **hasKey(key)**: Check whether or not a file is defined (Boolean)\n- **getApplicationName()**: Gets the application name defined in Nexus (String)\n- **getApplicationDescription()**: Gets the description of the application defined in Nexus (String)\n- **getAllKeys()**: Gets all configuration files as strings (Object)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetcinit%2Fnexus-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetcinit%2Fnexus-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetcinit%2Fnexus-client-js/lists"}