Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

FastConfig client for C#

Get configuration for your c# applications easily.

Connect to FastConfig server

To connect to FastConfig you need

  • Address
  • AppId - unique application name
  • Token - token created for a specific AppId or a master token
var fastConfig = new FastConfigClient(
  address: address,
  appId: appId,
  token: token
);

Using environment variables

Connection configuration is stored in following environment variables:

  • FASTCONFIG_ADDRESS
  • FASTCONFIG_APPID
  • FASTCONFIG_TOKEN

By passing a parameter you can override the env variable. In this case Address and Token are storen in environment variables and AppId is stored in code.

var fastConfig = FastConfigClient.FromEnvironment(
  appId: appId, 
);

Get configuration

Get configuration deserialized into your type.

var appConfig = await fastConfig.Get<YourConfig>();

Get configuration as a string.

string appConfig = await fastConfig.Get();

Send configuration

Send a class instance.

var config = new AnyClass();
await fastConfig.Send(config);

Send a string. The string must be a valid json.

await fastConfig.Send("{\"foo\": \"bar\"}");

Dependency Injection

You can add a FastConfig client to services using AddFastConfig.

var fastConfig = FastConfigClient.FromEnvironment();
...
services.AddFastConfig(fastConfig);