You can bundle services up into an IPlugin
, but you will have to set the routes manually. It's how things like /metadata
work.
public class MyOptionalServicesPlugin : IPlugin
{
public void Register(IAppHost appHost)
{
var settings = new AppSettings();
var enableSpecialService1 = settings.Get<bool>("enableSpecialService1", false);
if (enableSpecialService1)
{
appHost.RegisterService(typeof(SpecialService1), new[] { "/special/service-1" });
}
...
}
}
And then in your AppHost
:
public void Register(Funq.Container container)
{
Plugins.Add(new MyOptionsServicesPlugin());
...
}