Steeltoe
Steeltoe copied to clipboard
Give option to add a specific list of endpoints at startup
Add method that will only create a specific list of endpoints for creation at startup.
i.e. AddActuators(list of endpoint enums)
Propose introducing a builder pattern:
services.AddActuators(cfg =>
{
if (!cfg.Environment.IsDevelopment())
{
cfg.AddDefault(); // register common "core" actuators that don't have other dependencies and expose them on /actuator and publish only data that is not marked as secure (ex. no health details, just UP/DOWN)
}
else
{
cfg.AddDefault().ExposeAll(); // expose all endpoints
}
cfg.AddCloudFoundry(); // CF specific endpoint `/cloudfoundryapplication` PLUS security model
cfg.AddKubernetes(); // only appear when necessary dependencies are on added
cfg.Expose("myactuators") // start a new actuator "mount" point at /myactuators. ommiting this arg would mount individual actuator against root of the app endpoints
.AddHealth()
.AddInfo()
.Authorize("MyAuthorizationPolicy"); // standard authz policy name
});
The goal is to provide reasonable defaults for each environment while giving an intuitive fluent API to configure exposure across different scenarios and environments. This also allows mounting multiple actuator "root" points based on the given platform/security requirements.
The current way of configuring actuators is error-prone and cumbersome, especially when targeting CF & local simultaneously.
I think the bulk of concerns with this issue have been resolved by addition and evolution of .AddAllActuators, if there are additional ideas for improvement here, please let us know