{"id":21377710,"url":"https://github.com/quobject/consul-cli-js","last_synced_at":"2025-03-16T09:45:39.874Z","repository":{"id":57206279,"uuid":"46687411","full_name":"Quobject/consul-cli-js","owner":"Quobject","description":"A node.js wrapper for the consul command line tool","archived":false,"fork":false,"pushed_at":"2019-03-20T20:13:20.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T12:39:52.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Quobject.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":"2015-11-23T00:23:20.000Z","updated_at":"2019-03-20T20:13:21.000Z","dependencies_parsed_at":"2022-09-11T05:20:25.745Z","dependency_job_id":null,"html_url":"https://github.com/Quobject/consul-cli-js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fconsul-cli-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fconsul-cli-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fconsul-cli-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quobject%2Fconsul-cli-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quobject","download_url":"https://codeload.github.com/Quobject/consul-cli-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852430,"owners_count":20358270,"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-22T09:23:25.157Z","updated_at":"2025-03-16T09:45:39.846Z","avatar_url":"https://github.com/Quobject.png","language":"TypeScript","readme":"# consul-cli-js\nA node.js wrapper for the [consul](https://www.consul.io/) command line tool\n\n\n## Installation\n\n### Step 1: Prerequisites\n\nThe consul binary must be installed and accessible in the path [e.g. Installing Consul](https://www.consul.io/intro/getting-started/install.html)\n\n### Step 2: Installation\n\n    npm install consul-cli-js\n\nThen:\n\n```js\nvar consulCli = require('consul-cli-js');\nvar Options = consulCli.Options;\nvar Consul = consulCli.Consul;\n```\n\n## Usage\n\nWith promise\n\n```js\nvar options = new Options(\n  /* httpAddr    */ '0.0.0.0:8500',\n  /* currentWorkingDirectory */ null\n);\n\nvar consul = new Consul(options);\n\nconsul.command('members').then(function (data) {\n  console.log('data = ', data);\n});\n\n//data =  { command: 'consul members -rpc-addr 52.91.162.186:8400  ',\n//  raw: 'Node     Address          Status  Type    Build  Protocol  DC\\\\nconsul1  10.0.0.90:8301   alive   server  0.5.2  2\n//      dc1\\\\nconsul2  10.0.0.99:8301   alive   server  0.5.2  2         dc1\\\\nconsul3  10.0.0.213:8301  alive   server  0.5.2  2\n//dc1\\\\n',\n//members:\n//[ { node: 'consul1',\n//  address: '10.0.0.90:8301',\n//  status: 'alive',\n//  type: 'server',\n//  build: '0.5.2',\n//  protocol: '2',\n//  dc: 'dc1' },\n//  { node: 'consul2',\n//    address: '10.0.0.99:8301',\n//    status: 'alive',\n//    type: 'server',\n//    build: '0.5.2',\n//    protocol: '2',\n//    dc: 'dc1' },\n//  { node: 'consul3',\n//    address: '10.0.0.213:8301',\n//    status: 'alive',\n//    type: 'server',\n//    build: '0.5.2',\n//    protocol: '2',\n//    dc: 'dc1' } ],\n//  allMembersAlive: true }\n\n```\n\nWith callback:\n\n```js\n\nconsul.command('members', '', function (err, data) {\n  console.log('data = ', data);\n});\n\n```\n\n\nTypescript\n\n```js\nimport { Consul, Options } from 'consul-cli-js';\n\nconst options = new Options(\n  /* httpAddr */ '0.0.0.0:8500',\n  /* currentWorkingDirectory */ null\n);\n\nconst consul = new Consul(options);\n\nreturn consul.command('info', '', function (err, data) {\n  console.log('data = ', data);\n});\n\n```\n\n\n\n\n\n\n* join\n\n```js\nconsul.command('join', '54.86.97.135').then(function (data) {\n  console.log('data = ', data);\n});\n\n//data = {\n//  command: 'consul join -rpc-addr 52.91.162.186:8400  54.86.97.135',\n//  raw: 'Successfully joined cluster by contacting 1 nodes.\\\\n',\n//  line: 'Successfully joined cluster by contacting 1 nodes.',\n//  success: true\n//}\n\n```\n\n\n* info\n\n```js\nconsul.command('info').then(function (data) {\n  console.log('data = ', data);\n});\n\n//data = {\n//  command: 'consul info -rpc-addr 54.165.211.120:8400  ',\n//  raw: 'WARNING: It is highly recommended to set GOMAXPROCS higher than 1\\\\n\\\\nagent:\\\\n\\\\tcheck_monitors = 0\\\\n\\\\tcheck_ttls = 0\\\\n\\\\tchecks = 0\\\\n\\\\tservices = 1\\\\nbuild:\\\\n\\\\tprerelease = \\\\n\\\\trevision = 9a9cc934\\\\n\\\\tversion = 0.5.2\\\\nconsul:\\\\n\\\\tbootstrap = true\\\\n\\\\tknown_datacenters = 1\\\\n\\\\tleader = true\\\\n\\\\tserver = true\\\\nraft:\\\\n\\\\tapplied_index = 192\\\\n\\\\tcommit_index = 192\\\\n\\\\tfsm_pending = 0\\\\n\\\\tlast_contact = never\\\\n\\\\tlast_log_index = 192\\\\n\\\\tlast_log_term = 1\\\\n\\\\tlast_snapshot_index = 0\\\\n\\\\tlast_snapshot_term = 0\\\\n\\\\tnum_peers = 0\\\\n\\\\tstate = Leader\\\\n\\\\tterm = 1\\\\nruntime:\\\\n\\\\tarch = amd64\\\\n\\\\tcpu_count = 1\\\\n\\\\tgoroutines = 54\\\\n\\\\tmax_procs = 1\\\\n\\\\tos = linux\\\\n\\\\tversion = go1.4.2\\\\nserf_lan:\\\\n\\\\tencrypted = false\\\\n\\\\tevent_queue = 1\\\\n\\\\tevent_time = 2\\\\n\\\\tfailed = 0\\\\n\\\\tintent_queue = 0\\\\n\\\\tleft = 0\\\\n\\\\tmember_time = 1\\\\n\\\\tmembers = 1\\\\n\\\\tquery_queue = 0\\\\n\\\\tquery_time = 1\\\\nserf_wan:\\\\n\\\\tencrypted = false\\\\n\\\\tevent_queue = 0\\\\n\\\\tevent_time = 1\\\\n\\\\tfailed = 0\\\\n\\\\tintent_queue = 0\\\\n\\\\tleft = 0\\\\n\\\\tmember_time = 1\\\\n\\\\tmembers = 1\\\\n\\\\tquery_queue = 0\\\\n\\\\tquery_time = 1\\\\n',\n//  lines:\n//   ['WARNING: It is highly recommended to set GOMAXPROCS higher than 1',\n//     '',\n//     'agent:',\n//     '\\tcheck_monitors = 0',\n//     '\\tcheck_ttls = 0',\n//     '\\tchecks = 0',\n//     '\\tservices = 1',\n//     'build:',\n//     '\\tprerelease = ',\n//     '\\trevision = 9a9cc934',\n//     '\\tversion = 0.5.2',\n//     'consul:',\n//     '\\tbootstrap = true',\n//     '\\tknown_datacenters = 1',\n//     '\\tleader = true',\n//     '\\tserver = true',\n//     'raft:',\n//     '\\tapplied_index = 192',\n//     '\\tcommit_index = 192',\n//     '\\tfsm_pending = 0',\n//     '\\tlast_contact = never',\n//     '\\tlast_log_index = 192',\n//     '\\tlast_log_term = 1',\n//     '\\tlast_snapshot_index = 0',\n//     '\\tlast_snapshot_term = 0',\n//     '\\tnum_peers = 0',\n//     '\\tstate = Leader',\n//     '\\tterm = 1',\n//     'runtime:',\n//     '\\tarch = amd64',\n//     '\\tcpu_count = 1',\n//     '\\tgoroutines = 54',\n//     '\\tmax_procs = 1',\n//     '\\tos = linux',\n//     '\\tversion = go1.4.2',\n//     'serf_lan:',\n//     '\\tencrypted = false',\n//     '\\tevent_queue = 1',\n//     '\\tevent_time = 2',\n//     '\\tfailed = 0',\n//     '\\tintent_queue = 0',\n//     '\\tleft = 0',\n//     '\\tmember_time = 1',\n//     '\\tmembers = 1',\n//     '\\tquery_queue = 0',\n//     '\\tquery_time = 1',\n//     'serf_wan:',\n//     '\\tencrypted = false',\n//     '\\tevent_queue = 0',\n//     '\\tevent_time = 1',\n//     '\\tfailed = 0',\n//     '\\tintent_queue = 0',\n//     '\\tleft = 0',\n//     '\\tmember_time = 1',\n//     '\\tmembers = 1',\n//     '\\tquery_queue = 0',\n//     '\\tquery_time = 1',\n//     ''],\n//  info:\n//   {\n//     agent: { check_monitors: 0, check_ttls: 0, checks: 0, services: 1 },\n//     build: { prerelease: '', revision: '9a9cc934', version: '0.5.2' },\n//     consul:\n//      {\n//        bootstrap: true,\n//        known_datacenters: 1,\n//        leader: true,\n//        server: true\n//      },\n//     raft:\n//      {\n//        applied_index: 192,\n//        commit_index: 192,\n//        fsm_pending: 0,\n//        last_contact: 'never',\n//        last_log_index: 192,\n//        last_log_term: 1,\n//        last_snapshot_index: 0,\n//        last_snapshot_term: 0,\n//        num_peers: 0,\n//        state: 'Leader',\n//        term: 1\n//      },\n//     runtime:\n//      {\n//        arch: 'amd64',\n//        cpu_count: 1,\n//        goroutines: 54,\n//        max_procs: 1,\n//        os: 'linux',\n//        version: 'go1.4.2'\n//      },\n//     serf_lan:\n//      {\n//        encrypted: false,\n//        event_queue: 1,\n//        event_time: 2,\n//        failed: 0,\n//        intent_queue: 0,\n//        left: 0,\n//        member_time: 1,\n//        members: 1,\n//        query_queue: 0,\n//        query_time: 1\n//      },\n//     serf_wan:\n//      {\n//        encrypted: false,\n//        event_queue: 0,\n//        event_time: 1,\n//        failed: 0,\n//        intent_queue: 0,\n//        left: 0,\n//        member_time: 1,\n//        members: 1,\n//        query_queue: 0,\n//        query_time: 1\n//      }\n//   }\n//}\n\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquobject%2Fconsul-cli-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquobject%2Fconsul-cli-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquobject%2Fconsul-cli-js/lists"}