feat: expose application name via Appearance API (#9886)

This commit is contained in:
Marcin Tojek
2023-09-27 17:02:18 +02:00
committed by GitHub
parent 68738771b9
commit cb5f8df4c2
18 changed files with 212 additions and 21 deletions
+21
View File
@@ -4066,6 +4066,17 @@ func (q *sqlQuerier) GetAppSecurityKey(ctx context.Context) (string, error) {
return value, err
}
const getApplicationName = `-- name: GetApplicationName :one
SELECT value FROM site_configs WHERE key = 'application_name'
`
func (q *sqlQuerier) GetApplicationName(ctx context.Context) (string, error) {
row := q.db.QueryRowContext(ctx, getApplicationName)
var value string
err := row.Scan(&value)
return value, err
}
const getDERPMeshKey = `-- name: GetDERPMeshKey :one
SELECT value FROM site_configs WHERE key = 'derp_mesh_key'
`
@@ -4178,6 +4189,16 @@ func (q *sqlQuerier) UpsertAppSecurityKey(ctx context.Context, value string) err
return err
}
const upsertApplicationName = `-- name: UpsertApplicationName :exec
INSERT INTO site_configs (key, value) VALUES ('application_name', $1)
ON CONFLICT (key) DO UPDATE SET value = $1 WHERE site_configs.key = 'application_name'
`
func (q *sqlQuerier) UpsertApplicationName(ctx context.Context, value string) error {
_, err := q.db.ExecContext(ctx, upsertApplicationName, value)
return err
}
const upsertDefaultProxy = `-- name: UpsertDefaultProxy :exec
INSERT INTO site_configs (key, value)
VALUES