Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danesparza/consul-api
:mountain_cableway: C# API client for Consul
https://github.com/danesparza/consul-api
c-sharp client consul consul-api nuget
Last synced: 2 months ago
JSON representation
:mountain_cableway: C# API client for Consul
- Host: GitHub
- URL: https://github.com/danesparza/consul-api
- Owner: danesparza
- License: mit
- Created: 2014-11-15T12:33:52.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-29T18:19:32.000Z (almost 9 years ago)
- Last Synced: 2024-11-19T18:04:34.225Z (3 months ago)
- Topics: c-sharp, client, consul, consul-api, nuget
- Language: C#
- Homepage:
- Size: 479 KB
- Stars: 23
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
consul-api [![Build status](https://ci.appveyor.com/api/projects/status/b6l1hfiknqjxogrf?svg=true)](https://ci.appveyor.com/project/danesparza/consul-api)
==========Consul-API is a .NET client for the highly availble service discovery and configuration system, [Consul](https://www.consul.io/). It aims to be an easy-to-use client. Need [Consul installation instructions](https://www.consul.io/intro/getting-started/install.html)?
### Quick Start
Install the [NuGet package](https://www.nuget.org/packages/Consul-api/) from the package manager console:
```powershell
Install-Package Consul-api
```
Next, you will need to provide consul-api with your Consul server endpoint in code.In your application, call:
```CSharp
// Pass the Consul server location on the constructor:
ConsulManager client = new ConsulManager("http://your-consul-server.com:8500");// Next, make any API call you'd like:
ConfigItem configItem = client.GetConfigItem(configKey);
```### Examples
##### Getting a single configuration item:
```CSharp
using Consul;
using Consul.Config;// Create a consul client and get the config value for a specified key
ConsulManager client = new ConsulManager("http://your-consul-server.com:8500");
ConfigItem configItem = client.GetConfigItem("testing/testconfigitem");// If we can find the value ...
if(configItem != null)
{
// Print out the config value...
Console.WriteLine("The value for key '{0}' is '{1}' (The raw base64 value is: {2})", configItem.Key, configItem.Value, configItem.Base64Value);
}```