Metadata Properties
Fig automatically tracks when your settings are loaded and updated, providing you with metadata about the state of your configuration. This feature is particularly useful for monitoring, debugging, and implementing health checks in your applications.
Available Properties
All settings classes that inherit from SettingsBase automatically include two properties that provide information about the last update:
LastFigUpdateUtc
A DateTime? property that indicates when the settings were last successfully loaded or updated.
public class MySettings : SettingsBase
{
public string DatabaseConnection { get; set; }
public int RetryCount { get; set; }
// Inherited from SettingsBase
// public DateTime? LastFigUpdateUtc { get; }
}
// Usage
var settings = serviceProvider.GetRequiredService<IOptionsMonitor<MySettings>>();
var lastUpdate = settings.CurrentValue.LastFigUpdateUtc;
if (lastUpdate.HasValue)
{
Console.WriteLine($"Settings last updated: {lastUpdate.Value:yyyy-MM-dd HH:mm:ss} UTC");
}
else
{
Console.WriteLine("Settings have not been successfully loaded");
}
FigSettingLoadType
An enum property that indicates how the settings were loaded. This helps you understand whether your application is running with the latest server configuration or fallback values.
public enum LoadType
{
None, // Settings failed to load completely
Server, // Settings loaded from Fig API
Offline // Settings loaded from offline cache
}
// Usage
var settings = serviceProvider.GetRequiredService<IOptionsMonitor<MySettings>>();
var loadType = settings.CurrentValue.FigSettingLoadType;
switch (loadType)
{
case LoadType.Server:
Console.WriteLine("✓ Running with latest settings from Fig API");
break;
case LoadType.Offline:
Console.WriteLine("