Code Monkey home page Code Monkey logo

consul-client-go's Introduction

README

Consul client library for the Go implementation of EdgeX microservices. This project contains functions for initializing a connection to the Consul service, registering health checks and pulling key/value pairs from the consul service.

What is this repository for?

  • Initialize connection to Consul
  • Pull key/value pairs into a configuration struct

Installation

consul-client-go uses the glide vendoring tool - https://glide.sh/ To pull the dependecies into your workspace and build the project, make sure you are in the project directory and run:

go get github.com/edgexfoundry/consul-client-go
cd $GOPATH/src/github.com/edgexfoundry/consul-client-go
glide install
go install

How to Use

This library is used by Go programs for interacting with the Consul service and requires that a Consul agent is running somewhere that the Consul client can connect to. The host address and port of the Consul agent will be used to initialize a connection to the Consul service.

This library has 2 function calls for interacting with a Consul service:

func CheckKeyValuePairs(configurationStruct interface{}, applicationName string, profiles []string) error{ ... }

and

func ConsulInit(config ConsulConfig) error{ ... }

CheckKeyValuePairs

  • configurationStruct is struct of kay/values
    • Variable names will become the key names in consul
    • Pass a pointer to the struct so the actual struct is updated
    • profiles is an optional list of strings for organization in Consul

ConsulInit

  • Create a ConsulConfig object to initialize consul connection

Note: Look at the core microservices for examples on how to use the consul-client-go library

consul-client-go's People

Contributors

jpwhitemn avatar jwagantall avatar trcox avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.