Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add database support for dismissed healthchecks #10845

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

Merged
merged 9 commits into from
Nov 23, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Nov 23, 2023

Related: #10712

This PR adds database support for dismissed healthchecks. The idea is to store healthcheck settings in JSON format in site_configs.

@mtojek mtojek self-assigned this Nov 23, 2023
@mtojek mtojek marked this pull request as ready for review November 23, 2023 13:02
@mtojek mtojek requested a review from johnstcn November 23, 2023 13:02
@@ -70,3 +70,10 @@ SELECT value FROM site_configs WHERE key = 'oauth_signing_key';
-- name: UpsertOAuthSigningKey :exec
INSERT INTO site_configs (key, value) VALUES ('oauth_signing_key', $1)
ON CONFLICT (key) DO UPDATE set value = $1 WHERE site_configs.key = 'oauth_signing_key';

-- name: GetDismissedHealthchecks :one
SELECT value FROM site_configs WHERE key = 'dismissed_healthchecks';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we coalesce this to []?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it. There is one drawback of this approach: with [] we will close the structure for extra properties since it will accept only array items. I'm happy to change it to [] if you think that it is fair.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, we could also coalesce it to {} and then start off with {"dismissed": [...]} if you want to keep it open. My main point here was to avoid downstream consumers having to deal with a potential nil.

Copy link
Member Author

@mtojek mtojek Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will be open. Should I rename it to health_settings instead? (or healthpage_settings, healthcheck_settings)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Sounds good, I could imagine other persistent health-related site configs going in there.

Copy link
Member Author

@mtojek mtojek Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, converted it into health_settings with default value {}. The API implementation will be similar to the ServiceBanner

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking on my side.

@mtojek mtojek marked this pull request as draft November 23, 2023 15:16
@mtojek mtojek marked this pull request as ready for review November 23, 2023 16:09
@mtojek mtojek enabled auto-merge (squash) November 23, 2023 16:14
@mtojek mtojek merged commit a7c27ca into main Nov 23, 2023
@mtojek mtojek deleted the 10712-dismiss-warning branch November 23, 2023 16:18
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants