I have it sussed - you need a class that exactly matches the appsetting section
appsettings section
"APIHost": {
"APIHosts": [ "NUC", "M4V101", "M4V102", "M4V201", "M4V202", "M4V203" ]
}
public class APIHost : IAPIHost
{
public APIHost()
{
}
public List<string> APIHosts {get;set;}
}
And these lines in Startup.cs to bind the array
services.Configure<APIHost>(options => this.Configuration.GetSection("APIHost").Bind(options));
services.AddSingleton<IAPIHost,APIHost>();
And inject this in the Controller constructor
MyController(IOptions<APIHost> options)
and it works