Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/PostHog/Config/PostHogOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Options;
using PostHog.Library;

namespace PostHog;

Expand Down Expand Up @@ -26,6 +27,15 @@ public string? ProjectToken

internal bool HasLegacyProjectApiKey => _projectApiKey is not null;

internal void Normalize()
{
_projectToken = _projectToken.NullIfEmpty();
_projectApiKey = _projectApiKey.NullIfEmpty();
PersonalApiKey = PersonalApiKey.NullIfEmpty();
HostUrl = HostUrl.NormalizeHostUrl();
Disabled = Disabled || ProjectToken is null;
}

/// <summary>
/// Obsolete alias for <see cref="ProjectToken"/>.
/// </summary>
Expand All @@ -49,6 +59,11 @@ public string? ProjectApiKey
/// </remarks>
public string? PersonalApiKey { get; set; }

/// <summary>
/// Whether this client is disabled and should no-op instead of sending data to PostHog. (Default: false)
/// </summary>
public bool Disabled { get; set; }

/// <summary>
/// PostHog API host, usually 'https://us.i.posthog.com' (default) or 'https://eu.i.posthog.com'
/// </summary>
Expand Down
Loading
Loading