* Moved configuration to post build actions

* Added option to completelly disable automatic configuration
This commit is contained in:
2025-08-02 00:27:23 +04:00
parent 088d6166ce
commit b8e4398b50
5 changed files with 16 additions and 7 deletions
+7 -4
View File
@@ -49,10 +49,6 @@ namespace Telegrator.Hosting
_handlers = new HostHandlersCollection(Services, _settings);
_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>
@@ -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);
}
}