* Moved configuration to post build actions
* Added option to completelly disable automatic configuration
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user