I have the following section in my appsettings.json file for my aspnet vnext application.
"Settings": {
"IgnoredServices" : ["ignore1", "ignore2"]
}
}
This works quite happily in mapping using IOptions<Settings>, where the settings class is
public class Settings
{
public List<string> IgnoredServices { get; set; }
}
However, I am struggling to override this json file option with an environment variable form. I have tried
Name Settings:IgnoredServices
Value "ignore1", "ignore2"
and
Name Settings:IgnoredServices
Value ["ignore1", "ignore2"]
Neither seem to map correctly and I get the following error message
System.InvalidOperationException: Failed to convert '["ignore1", "ignore2"]'
to type 'System.Collections.Generic.List`1[System.String]
What format should I put my values into environment variables to be successfully interpreted as the correct list of strings?