[PATCH hg.sr.ht] api: Add settings field to version
Export this patch
# HG changeset patch
# User Thorben Günther <admin@xenrox.net>
# Date 1650478167 -7200
# Wed Apr 20 20:09:27 2022 +0200
# Node ID 6bceb227ff7a7b197c20992230ee662ad11892ef
# Parent 237d8f3beedcc0796aba697f8d44120db338e92f
api: Add settings field to version
diff --git a/api/graph/schema.graphqls b/api/graph/schema.graphqls
--- a/api/graph/schema.graphqls
+++ b/api/graph/schema.graphqls
@@ -46,6 +46,9 @@
"Optional features"
features: Features!
+
+ "Config settings"
+ settings: Settings!
}
"Describes the status of optional features"
@@ -53,6 +56,11 @@
artifacts: Boolean!
}
+ "Instance specific settings"
+ type Settings {
+ sshUser: String!
+ }
+
enum AccessMode {
"Read-only"
RO
diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
--- a/api/graph/schema.resolvers.go
+++ b/api/graph/schema.resolvers.go
@@ -493,6 +493,10 @@
}
func (r *queryResolver) Version(ctx context.Context) (*model.Version, error) {
+ conf := config.ForContext(ctx)
+ sshUser, _ := conf.Get("hg.sr.ht::dispatch", "/usr/bin/hgsrht-keys")
+ sshUser = strings.Split(sshUser, ":")[0]
It's unintuitive, but I believe all the ssh key executables are under
`git.sr.ht::dispatch` for historical reasons. So I don't think this will
ever get anything, unless something has changed that I don't know about?
+
return &model.Version{
Major: 0,
Minor: 0,
@@ -500,6 +504,9 @@
DeprecationDate: nil,
Features: &model.Features{},
+ Settings: &model.Settings{
+ SSHUser: sshUser,
+ },
}, nil
}