* Moved configuration to post build actions
* Added option to completelly disable automatic configuration
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
|
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<Version>1.0.8</Version>
|
<Version>1.0.8.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -49,10 +49,6 @@ namespace Telegrator.Hosting
|
|||||||
_handlers = new HostHandlersCollection(Services, _settings);
|
_handlers = new HostHandlersCollection(Services, _settings);
|
||||||
|
|
||||||
_innerBuilder.Logging.ClearProviders();
|
_innerBuilder.Logging.ClearProviders();
|
||||||
|
|
||||||
Services.Configure<TelegratorOptions>(Configuration.GetSection(nameof(TelegratorOptions)));
|
|
||||||
Services.Configure<ReceiverOptions>(Configuration.GetSection(nameof(ReceiverOptions)));
|
|
||||||
Services.Configure<TelegramBotClientOptions>(Configuration.GetSection(nameof(TelegramBotClientOptions)), new TelegramBotClientOptionsProxy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,6 +69,13 @@ namespace Telegrator.Hosting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_settings.DisableAutoConfigure)
|
||||||
|
{
|
||||||
|
Services.Configure<TelegratorOptions>(Configuration.GetSection(nameof(TelegratorOptions)));
|
||||||
|
Services.Configure<ReceiverOptions>(Configuration.GetSection(nameof(ReceiverOptions)));
|
||||||
|
Services.Configure<TelegramBotClientOptions>(Configuration.GetSection(nameof(TelegramBotClientOptions)), new TelegramBotClientOptionsProxy());
|
||||||
|
}
|
||||||
|
|
||||||
return new TelegramBotHost(_innerBuilder, _handlers);
|
return new TelegramBotHost(_innerBuilder, _handlers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Telegrator.Hosting
|
namespace Telegrator.Hosting
|
||||||
{
|
{
|
||||||
@@ -8,6 +9,11 @@ namespace Telegrator.Hosting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class TelegramBotHostBuilderSettings() : TelegratorOptions
|
public class TelegramBotHostBuilderSettings() : TelegratorOptions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Disables automatic configuration for all of required <see cref="IOptions{TOptions}"/> instances
|
||||||
|
/// </summary>
|
||||||
|
public bool DisableAutoConfigure { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc cref="HostApplicationBuilderSettings.DisableDefaults"/>
|
/// <inheritdoc cref="HostApplicationBuilderSettings.DisableDefaults"/>
|
||||||
public bool DisableDefaults { get; set; }
|
public bool DisableDefaults { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
|
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<Version>1.0.8</Version>
|
<Version>1.0.8.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<EnableNETAnalyzers>True</EnableNETAnalyzers>
|
<EnableNETAnalyzers>True</EnableNETAnalyzers>
|
||||||
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
|
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<Version>1.0.8</Version>
|
<Version>1.0.8.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user