bungeemonkee / Configgy

A simple, powerful, extensible, testable .NET configuration library.
MIT License
41 stars 4 forks source link

Configgy

Configgy: The Last Configuration Library for .NET

A simple, powerful, extensible, testable .NET configuration library.

Build Status NuGet Version

Documentation

README

  1. Overview
    1. Cache
    2. Source
    3. Transform
    4. Validate
    5. Coerce
  2. Other Features
  3. Advanced Usage

Description

Configgy is the last .NET configuration library you'll ever need. It is designed to support configuration values coming from any source, with any kind of validation, and then expose it all as strong types - even complex types like lists, dictionaries, or general .NET objects.

Usage

The simplest usage of Configgy is to inherit from Configgy.Config and add the configuration properties you want like this:


using System;
using Configgy;

public class MyConfig: Config, IMyConfig
{   
    [DefaultValue(100)] //assign a default value.
    public int MaxThingCount { get { return Get<int>(); } }
    [DefaultValue("Server=server;Database=db;User Id=usr;Password=pwd;")] //assign a default value.
    public string DatabaseConectionString { get { return Get<string>(); } }        
    public DateTime WhenToShutdown { get { return Get<DateTime>(); } }

    //use expression bodied statements
    public int MinThingCount => Get<int>();
}

Installation

You can build from this source or you can get it from nuget here: https://www.nuget.org/packages/Configgy

Design

The basic design of Configgy boils down to a few key points:

Features

Here are a bunch of things supported by Configgy out of the box:

Extensibility

Here are a bunch of things that are really easy to do because of the Configgy design

Bugs And Feature Requests

Any TODO items, feature requests, bugs, etc. will be tracked as GitHub issues here: https://github.com/bungeemonkee/Configgy/issues

Thanks

Thanks to Alex Bielen for the awesome logo!