-
Notifications
You must be signed in to change notification settings - Fork 15
Fix accessing remote config settings #53
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,10 @@ public class IndexModel(IOptions<PostHogOptions> options, IPostHogClient posthog | |
| [FromQuery] | ||
| public string? FeatureFlagKey { get; set; } | ||
|
|
||
| public string? UnencryptedRemoteConfigSetting { get; set; } | ||
|
|
||
| public string? EncryptedRemoteConfigSetting { get; set; } | ||
|
|
||
| public async Task OnGetAsync() | ||
| { | ||
| ApiKeyIsSet = options.Value.ProjectApiKey is not (null or []); | ||
|
|
@@ -103,6 +107,10 @@ await posthog.IdentifyAsync( | |
| } | ||
|
|
||
| NonExistentFlag = await posthog.IsFeatureEnabledAsync("non-existent-flag", UserId); | ||
|
|
||
| UnencryptedRemoteConfigSetting = (await posthog.GetRemoteConfigPayloadAsync("unencrypted-remote-config-setting", HttpContext.RequestAborted))?.RootElement.GetRawText(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: GetRawText() may throw if RootElement is invalid JSON. Consider wrapping in try-catch |
||
|
|
||
| EncryptedRemoteConfigSetting = (await posthog.GetRemoteConfigPayloadAsync("encrypted-remote-config-setting", HttpContext.RequestAborted))?.RootElement.GetRawText(); | ||
|
Comment on lines
+111
to
+113
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: These calls could be parallelized using Task.WhenAll for better performance |
||
| } | ||
| } | ||
|
|
||
|
|
||
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.
style: The '>' character before @Model.UnencryptedRemoteConfigSetting seems unnecessary and inconsistent with the encrypted setting display below