-
Notifications
You must be signed in to change notification settings - Fork 7
Improve configuration of the PostHog client #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR introduces a builder pattern for PostHog configuration in ASP.NET Core applications, improving service registration flexibility and configuration options.
- Added new
PostHogOptionsBuilder
in/src/PostHog.AspNetCore/PostHogOptionsBuilder.cs
for structured configuration - Removed
/src/PostHog.AspNetCore/Library/Ensure.cs
utility class - ensure null checking is handled appropriately in new implementation - Modified
/src/PostHog.AspNetCore/Registration.cs
to use builder pattern and returnIHostApplicationBuilder
for better method chaining - Updated version from 1.0.0-beta.8 to 1.0.0-beta.9 across configuration files
- Added internal visibility between PostHog and PostHog.AspNetCore assemblies in
/src/PostHog/Config/AssemblyInfo.cs
7 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
=> UseConfigurationSection(builder.Configuration.GetSection(configurationSectionName)); | ||
|
||
/// <summary> | ||
/// Specifies the the configuration section to use for PostHog options. If this call is omitted, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Typo in XML comment - 'the the' is duplicated
/// Specifies the the configuration section to use for PostHog options. If this call is omitted, | |
/// Specifies the configuration section to use for PostHog options. If this call is omitted, |
/// </summary> | ||
/// <param name="builder">The <see cref="IHostApplicationBuilder"/>.</param> | ||
/// <param name="configurationSection">The configuration section where to load config settings.</param> | ||
/// <param name="options">Provides a mean to configure the <see cref="PostHogClient"/> and some of the services it uses.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: typo in XML comment: 'Provides a mean' should be 'Provides a means'
/// <param name="options">Provides a mean to configure the <see cref="PostHogClient"/> and some of the services it uses.</param> | |
/// <param name="options">Provides a means to configure the <see cref="PostHogClient"/> and some of the services it uses.</param> |
builder.Services.AddSingleton<ITaskScheduler, TaskRunTaskScheduler>(); | ||
builder.Services.AddSingleton<IPostHogClient, PostHogClient>(); | ||
return builder.Services.AddHttpClient(nameof(PostHogClient)); | ||
options = NotNull(options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: NotNull check on options happens after builder - should check builder first since it's the primary parameter
options = NotNull(options); | |
builder = NotNull(builder); | |
options = NotNull(options); |
No description provided.