netdaemon icon indicating copy to clipboard operation
netdaemon copied to clipboard

Add support for dotnet user-secrets in nd-codegen

Open PartemImperium opened this issue 2 years ago • 1 comments

The problem

I use dotnet user-secrets to store my HA host info as I dont want it stored in source control. As such I would need to use the cli parameters to specify the host instead of just letting it grab it automatically.

The proposed solution

Add support for dotnet user-secrets. This can be done by adding the nuget package and a line in the GetConfigurationRoot function (https://github.com/net-daemon/netdaemon/blob/dev/src/HassModel/NetDaemon.HassModel.CodeGenerator/Program.cs#L52) to add the user-secrets provider. This guide outlines the steps to add user-secrets (https://makolyte.com/how-to-add-user-secrets-in-a-dotnetcore-console-app/).

The alternatives

Settings in dotnet user-secrets will not get used and therefore will have to be passed by hand.

Additional context

Thinking about it the user-secrets works with the "UserSecretsId" in the csproj to match to the correct settings. This may make this not feasible.

I would be willing to do the work and make a PR if we decide we like the idea.

PartemImperium avatar Apr 06 '22 05:04 PartemImperium

Yea I think this is an good idea. The aim of the new design was to use .NET standard way of handling configuration.

helto4real avatar Apr 09 '22 11:04 helto4real