Skip to content

Pull UseNetDaemonAppSettings extension method's ConfigureSerices into its own extension method #697

@PartemImperium

Description

@PartemImperium

The problem

Currently the HostBuilderExtensions.UseNetDaemonAppSettings function both configures the ServiceCollection and adds the Configuration sources that netdaemon uses by default. I would like to use the default/ my own configuration providers and not use the "HostbuilderExtensions.UseNetDaemonAppSettings" function. However because it both configure's the service collection and adds the providers I need to manually add the 2 lines in the ConfigureServices (https://github.com/net-daemon/netdaemon/blob/main/src/Runtime/NetDaemon.Runtime/Common/Extensions/HostBuilderExtensions.cs#L15-L16).

The proposed solution

Add an extension method on IServiceCollection that adds those 2 dependancies. This new method can be called from the existing HostbuilderExtensions.UseNetDaemonAppSettings to maintain backwards compatibility while allowing a single spot to add dependancies needed for the app. Therefore if someone chooses to manually set up the config providers they do not need to keep up on adding dependancies when changes are made in the future.

The alternatives

When someone wants to manually set up the config providers they have to manually add these 2 (and keep up with any changes in the UseNetDaemonAppSettings function).

Additional context

I would be happy to make the changes and PR if we like the idea.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions