Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 1.71 KB

File metadata and controls

64 lines (42 loc) · 1.71 KB

.NET

Installation

The Appconfi .NET SDK is available as a Nuget package, to install run the following command in the Package Manager Console

Install-Package Appconfi

More info is available on nuget

Usage

In order to use the Appconfi you will need to create an account.

From there you can create your first application and setup your configuration. To use the Appconfi API to access your configuration go to /accesskeys there you can find the application_id and your application_secret.

How to use

var manager = Configuration.NewInstance(applicationId, apiKey);

//Start monitoring changes
manager.StartMonitor();

//Access your application setting
var  mySetting = manager.GetSetting("my_application_setting");

//Check if a feature toggle is enable
var isEnabled = manager.IsFeatureEnabled("awesome_feature");

Optional parameters

Change your environments:

//Define your environment
var env = "PRODUCTION";

//Define a refresh interval for your configuration
var refreshInterval =  TimeSpan.FromSeconds(10);

//Define a function to resolve your setting in case of error
Func<string,string> getSetting = (key)=>ConfigurationManager.AppSettings[key];

//Define a function to check the feature toggle in case of error
Func<string,bool> getFeatureToggle = (key)=>YourToggleManager.IsEnabled(key);

//Logs errors
var logger = new MyCustomLogger()

var manager = Configuration.NewInstance(
    applicationId, 
    apiKey, 
    env, 
    refreshInterval, 
    getSetting, 
    getFeatureToggle,
    logger);