Certificates and ACME keys are stored encrypted in the database, namespaced per owner so an organization's servers cannot read platform or other organizations' keys. Locks live in Redis and expire. Refs #22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
17 lines
728 B
SQL
17 lines
728 B
SQL
-- name: StorageGet :one
|
|
SELECT value, modified FROM agent_storage WHERE owner = $1 AND key = $2;
|
|
|
|
-- name: StoragePut :exec
|
|
INSERT INTO agent_storage (owner, key, value) VALUES ($1, $2, $3)
|
|
ON CONFLICT (owner, key) DO UPDATE SET value = EXCLUDED.value, modified = now();
|
|
|
|
-- name: StorageDelete :execrows
|
|
-- Deletes key and, as certmagic expects, everything below it.
|
|
DELETE FROM agent_storage
|
|
WHERE owner = sqlc.arg(owner) AND (key = sqlc.arg(key) OR starts_with(key, sqlc.arg(key)::text || '/'));
|
|
|
|
-- name: StorageList :many
|
|
SELECT key, length(value)::bigint AS size, modified FROM agent_storage
|
|
WHERE owner = sqlc.arg(owner) AND (sqlc.arg(prefix)::text = '' OR starts_with(key, sqlc.arg(prefix)::text || '/'))
|
|
ORDER BY key;
|