netdaemon icon indicating copy to clipboard operation
netdaemon copied to clipboard

remove dependecy on appsettings.json and make it optional

Open helto4real opened this issue 3 years ago • 3 comments

Describe your feature

Example code

// Insert any example code here that will help describe your requests

Additional information

Added by Discord user helto

helto4real avatar Feb 11 '22 10:02 helto4real

On a similar note putting in documentation for using dotnet user-secrets (https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=linux) for the host info so it isnt in source control would be nice. It works out of the box (assuming you remove the corresponding config from appsettings.json so they dont get overridden) as the template uses Host.CreateDefaultBuilder() as its base.

PartemImperium avatar Apr 05 '22 08:04 PartemImperium

Just wondering what the motivation for this suggestion is. We ship with a default appsettings that just works(tm) and if you start to do anything remotely complex (custom logging, mqtt etc.) then you need to reinstate it.

skotl avatar Jun 25 '22 10:06 skotl

Looking at these lines where we add the appsettings.json file they are redundant when using Host.CreateDefaultBuilder(args) and could be removed. However if we are want to continue explicitly adding them we are already specifying that apssetings.json and appsettings.{Environment}.json are optional with the bool true after the file name so I think we can close this?

PartemImperium avatar Jun 27 '22 22:06 PartemImperium

I don't have appsettings.json in my container, it uses the settings from environment and that works just fine.

Closing this issue

FrankBakkerNl avatar Oct 22 '22 19:10 FrankBakkerNl