Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

consulkit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consulkit

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

consulkit

Ruby API for interacting with HashiCorp's Consul, heavily inspired by GitHub's Octokit.

Installation

gem "consulkit"

Usage

Get a client using the default options:

client = Consulkit::Client.new

...or provide customized options:

client = Consulkit.Client.new(http_addr: "https://consul.example.com", http_token: "token")

KV Store

Reading keys:

# Read a single key
client.kv_read_single("foo")
# => {"LockIndex"=>0, "Key"=>"foo", "Flags"=>1234, "Value"=>"bar", "CreateIndex"=>3532, "ModifyIndex"=>3914}

# Read key recursively
client.kv_read_recursive("foo")
# => [{"LockIndex"=>0, "Key"=>"foo", "Flags"=>1234, "Value"=>"bar", "CreateIndex"=>3532, "ModifyIndex"=>3914}, ...]

# Specify your own query parameters
client.kv_read("foo", raw: true)
# => "bar"

Writing keys:

# Write a key
client.kv_write("foo", "bar", flags: 1234)
# => true

# Write a key if it doesn't exist
client.kv_write_cas("foo", "bar", 0)
=> false

> client.kv_write_cas("bar", "baz", 0)
=> true

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

FAQs

Package last updated on 06 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc