Steeltoe icon indicating copy to clipboard operation
Steeltoe copied to clipboard

Give option to add a specific list of endpoints at startup

Open jkonicki opened this issue 5 years ago • 1 comments

Add method that will only create a specific list of endpoints for creation at startup.

i.e. AddActuators(list of endpoint enums)

jkonicki avatar Jun 25 '20 14:06 jkonicki

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.

macsux avatar Feb 03 '21 22:02 macsux

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

TimHess avatar Oct 06 '22 19:10 TimHess