-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull config out of RunnerService (#158)
* Context * Post merge clean. * Update client. Add support for context. Move things around a little. * Fix name, also in an attempt to re-run tests on build server. * Pull config out of runner service, use .net core built-in configuration. Environment variables take preference over daemon_config. * * Break apart HA settings from NetDaemon settings * Remove HostBuilderExtensions - No need to generate a sample config file. It now comes with one (appsettings.json) - No need to add json or env variables as generic host add these automatically Runner.cs * Pulled HassIO config file to environment variables out and into its own method (readability) - Comment out HASSCLIENT_MSGLOGLEVEL, couldn't see any usages - Comment out HASS_RUN_PROJECT_FOLDER, couldn't see any usages * Register HA and ND settings in IOC RunnerService.cs * Inject settings * Extract generate entities code into its own method (readability) * PR comments. Default config host value should be localhost. * PR comments. * PR comments. * Move hosting code to Service. * PR comments. These are used by hass client. * Update some docker variables. * Allow changing of minimum log level by config or environment variables. * Update project folder variable.
- Loading branch information
Showing
18 changed files
with
233 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using NetDaemon.Service; | ||
using NetDaemon.Service.Configuration; | ||
|
||
namespace NetDaemon | ||
{ | ||
public static class NetDaemonExtensions | ||
{ | ||
public static IHostBuilder UseNetDaemon(this IHostBuilder hostBuilder) | ||
{ | ||
return hostBuilder.ConfigureServices((context, services) => | ||
{ | ||
services.Configure<HomeAssistantSettings>(context.Configuration.GetSection("HomeAssistant")); | ||
services.Configure<NetDaemonSettings>(context.Configuration.GetSection("NetDaemon")); | ||
services.AddHttpClient(); | ||
services.AddHostedService<RunnerService>(); | ||
}); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/DaemonRunner/DaemonRunner/Service/Configuration/HomeAssistantSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace NetDaemon.Service.Configuration | ||
{ | ||
public class HomeAssistantSettings | ||
{ | ||
public string Host { get; set; } = "localhost"; | ||
public short Port { get; set; } = 8123; | ||
public bool Ssl { get; set; } = false; | ||
public string Token { get; set; } = string.Empty; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/DaemonRunner/DaemonRunner/Service/Configuration/NetDaemonSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace NetDaemon.Service.Configuration | ||
{ | ||
public class NetDaemonSettings | ||
{ | ||
public bool? GenerateEntities { get; set; } = false; | ||
public string? SourceFolder { get; set; } = null; | ||
public string? ProjectFolder { get; set; } = string.Empty; | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
src/DaemonRunner/DaemonRunner/Service/Extensions/HostBuilderExtensions.cs
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/DaemonRunner/DaemonRunner/Service/Extensions/ServiceCollectionExtensions.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.