Generated by AurionDocs
Job ID: 934f8c39-8082-4942-8d17-72ed8f5f8d50
Source commit: 40aea9a
1.5 KiB
IrcServiceExtensions
File:
src/EchoHub.Server.Irc/IrcServiceExtensions.cs
Kind: class
public static class IrcServiceExtensions
Extends WebApplicationBuilder with AddIrcGateway to wire IRC gateway support into an ASP.NET Core app. It configures IrcOptions from configuration and, when Irc:Enabled is true, registers IrcGatewayService as a singleton, wires IChatBroadcaster to IrcBroadcaster, and adds the gateway as a hosted service, returning the original builder for fluent chaining.
Remarks
This extension encapsulates opt-in startup logic and centralizes the wiring of the IRC gateway, ensuring consistent DI lifetimes and configuration handling across the app. It coordinates the lifecycle of IrcGatewayService and the broadcaster (IChatBroadcaster implemented by IrcBroadcaster) by hosting the gateway as a background service.
Notes
- Calling
AddIrcGatewaymultiple times can register multiple hosted services and singletons; call it once during startup to avoid duplicate registrations. - The extension only activates when
Irc:Enabledis true. If the flag is false or missing, it will configureIrcOptionsbut will not start or register the gateway components. Ensure configuration sources are loaded before invocation.