feat: platform admins can switch off check types
Types an installation cannot offer, such as Docker on shared cloud checkers, can be switched off in the admin panel. They are not offered in the editor or accepted by the API for new monitors or type changes; existing monitors keep running and stay editable. The setting lives in a new platform_settings table and reaches every replica at once through the versioned cache. GET /api/v1/org/check-types lists what is offered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
5a644e4ae5
commit
fb03b28df7
19 files changed
+627
-160
No files matched your search
@@ -264,6 +264,12 @@ type Org struct {
|
||||
ApiTokenMaxDays *int32
|
||||
}
|
||||
|
||||
type PlatformSetting struct {
|
||||
Key string
|
||||
Value []byte
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type RecoveryCode struct {
|
||||
UserID uuid.UUID
|
||||
CodeHash []byte
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: platform_settings.sql
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const getPlatformSetting = `-- name: GetPlatformSetting :one
|
||||
SELECT value FROM platform_settings WHERE key = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetPlatformSetting(ctx context.Context, key string) ([]byte, error) {
|
||||
row := q.db.QueryRow(ctx, getPlatformSetting, key)
|
||||
var value []byte
|
||||
err := row.Scan(&value)
|
||||
return value, err
|
||||
}
|
||||
|
||||
const setPlatformSetting = `-- name: SetPlatformSetting :exec
|
||||
INSERT INTO platform_settings (key, value) VALUES ($1, $2)
|
||||
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = now()
|
||||
`
|
||||
|
||||
type SetPlatformSettingParams struct {
|
||||
Key string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (q *Queries) SetPlatformSetting(ctx context.Context, arg SetPlatformSettingParams) error {
|
||||
_, err := q.db.Exec(ctx, setPlatformSetting, arg.Key, arg.Value)
|
||||
return err
|
||||
}
|
||||
@@ -112,6 +112,7 @@ type Querier interface {
|
||||
GetMonitor(ctx context.Context, id uuid.UUID) (Monitor, error)
|
||||
GetOrg(ctx context.Context, id uuid.UUID) (Org, error)
|
||||
GetOrgBySlug(ctx context.Context, slug string) (Org, error)
|
||||
GetPlatformSetting(ctx context.Context, key string) ([]byte, error)
|
||||
GetRegion(ctx context.Context, id uuid.UUID) (Region, error)
|
||||
GetRole(ctx context.Context, id uuid.UUID) (Role, error)
|
||||
GetSSOProvider(ctx context.Context, id uuid.UUID) (SsoProvider, error)
|
||||
@@ -239,6 +240,7 @@ type Querier interface {
|
||||
ResultsByChecker(ctx context.Context, arg ResultsByCheckerParams) ([]ResultsByCheckerRow, error)
|
||||
ScrubAuditEmail(ctx context.Context, email string) error
|
||||
SetPasswordHash(ctx context.Context, arg SetPasswordHashParams) error
|
||||
SetPlatformSetting(ctx context.Context, arg SetPlatformSettingParams) error
|
||||
// Changing the domain drops a previous verification.
|
||||
SetStatusPageDomain(ctx context.Context, arg SetStatusPageDomainParams) (StatusPage, error)
|
||||
SetUserAdmin(ctx context.Context, arg SetUserAdminParams) (int64, error)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-- name: GetPlatformSetting :one
|
||||
SELECT value FROM platform_settings WHERE key = $1;
|
||||
|
||||
-- name: SetPlatformSetting :exec
|
||||
INSERT INTO platform_settings (key, value) VALUES ($1, $2)
|
||||
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = now();
|
||||
Reference in new issue
Block a user