chore: add derpserver to wsproxy, add proxies to derpmap (#7311)

This commit is contained in:
Dean Sheather
2023-07-26 09:21:04 -07:00
committed by GitHub
parent 70692c2e4e
commit 2f0a9996e7
58 changed files with 3001 additions and 386 deletions

View File

@ -7,20 +7,22 @@ INSERT INTO
name,
display_name,
icon,
derp_enabled,
token_hashed_secret,
created_at,
updated_at,
deleted
)
VALUES
($1, '', '', $2, $3, $4, $5, $6, $7, false) RETURNING *;
($1, '', '', $2, $3, $4, $5, $6, $7, $8, false) RETURNING *;
-- name: RegisterWorkspaceProxy :one
UPDATE
workspace_proxies
SET
url = @url,
wildcard_hostname = @wildcard_hostname,
url = @url :: text,
wildcard_hostname = @wildcard_hostname :: text,
derp_enabled = @derp_enabled :: boolean,
updated_at = Now()
WHERE
id = @id

View File

@ -1,6 +1,9 @@
-- name: GetReplicasUpdatedAfter :many
SELECT * FROM replicas WHERE updated_at > $1 AND stopped_at IS NULL;
-- name: GetReplicaByID :one
SELECT * FROM replicas WHERE id = $1;
-- name: InsertReplica :one
INSERT INTO replicas (
id,
@ -11,8 +14,9 @@ INSERT INTO replicas (
region_id,
relay_address,
version,
database_latency
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING *;
database_latency,
"primary"
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING *;
-- name: UpdateReplica :one
UPDATE replicas SET
@ -24,7 +28,8 @@ UPDATE replicas SET
hostname = $7,
version = $8,
error = $9,
database_latency = $10
database_latency = $10,
"primary" = $11
WHERE id = $1 RETURNING *;
-- name: DeleteReplicasUpdatedBefore :exec