No commit activity in last 3 years
No release in over 3 years
Simple Ruby client for ConfigHub
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 10.0
~> 3.0

Runtime

>= 4.2.0
>= 0.12.2
 Project Readme

Ruby ConfigHub client

Installation

Add this to your Gemfile:

gem 'config_hub-client'

then bundle install

Or install globally:

gem install config_hub-client

Setup

# create a client instance
client = ConfigHub::Client.new(
    'https://config.example.com',
    'your-confighub-token',
    'context1;context2;context3'
)
 
# request config for your context from the server and store it locally
# you can call it again to refresh the data
client.pull

# create a client instance with options
client = ConfigHub::Client.new(
    'https://config.example.com',
    'your-confighub-token',
    'context1;context2;context3',
    { tag: 'yourtaglabel' }
)

Usage

# get a configuration value from local cache
# does not request data from the server
value = client.fetch('your.config.key') { 'default value' }

# get a file's contents
file = client.fetch_file('your.file.key')

# if you have pulled config without the No-Files option 
# the file will be returned from local cache

# if you have not pulled, or have pulled with the No-Files option
# then a request will be made to /rest/rawFile