Code Monkey home page Code Monkey logo

consulstructure's Introduction

ConsulStructure โ€“ Simple no-dependency configuration

Sometimes you just want very simple configuration that doesn't suck, without bringing in a whole set of packages for it, so you can hit go as quickly as possible.

Quickstart

ConsulStructure ships as a source-code package, so you don't add more pressure to your dependency graph.

You will be able to add the code through nuget, when I publish it.

Install-Package ConsulStructure

To start receiving updates from Consul into your settings, it's one line, no dependencies, no frills.

var configuration = my ProjectConfiguration {
  MyValue = "a very good value", // key: /myvalue
  Subconfiguration = {
    IsStructureAwesome = true // key: /subconfiguration/isstructureawesome
  }
};
var updater = Structure.New(configuration);

Your configuration class can have any level of nesting, it's up to you what it looks like. Any change to consul is reflected immediately in your class.

Supported types

Currently, Structure supports nesting, and a couple of base data types for keys, bool, string, int. As consul only sees values as byte arrays, Converters are customisable to match your needs.

How does it work

On starting up, Structure pre-compiles all the keys in your system, so there is no run-time reflection. It then does a continuous polling on the agent's HTTP API, to receive values as soon as they become available.

Whenever a key is updated, the value is assigned immediately, and fast. The data is parsed as json using the excellent SimpleJson library.

Things to do

  • Test HTTP part of the library
  • Create AppVeyor / Travis build
  • Create nuget package
  • Add all base datatype converters
  • Add converters for go's way of writing data (dates and timespans come to mind)

Credits

This project is inspired by the excellent functionality provided by the Go-based [consulstructure](https://github.com/mitchellh/consulstructure/], and uses SimpleJson for embeded json serialisation.

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.