~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH hg.sr.ht] api: Add settings field to version

Details
Message ID
<6bceb227ff7a7b197c20.1650478848@asgard>
DKIM signature
missing
Download raw message
Patch: +15 -0
# 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]

	return &model.Version{
		Major:           0,
		Minor:           0,
@@ -500,6 +504,9 @@
		DeprecationDate: nil,

		Features: &model.Features{},
		Settings: &model.Settings{
			SSHUser: sshUser,
		},
	}, nil
}
Details
Message ID
<ad5f6f69-7c49-4ea4-8f5f-26badbc6748a@www.fastmail.com>
In-Reply-To
<6bceb227ff7a7b197c20.1650478848@asgard> (view parent)
DKIM signature
missing
Download raw message
> +     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?
Details
Message ID
<20220501145726.kfxjgtuplvrfqah3@xenrox.net>
In-Reply-To
<ad5f6f69-7c49-4ea4-8f5f-26badbc6748a@www.fastmail.com> (view parent)
DKIM signature
missing
Download raw message
On Sat, Apr 30, 2022 at 05:27:13PM -0700, Ludovic Chabant wrote:
> 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?

While it is true that the config has the "git.sr.ht::dispatch" entry,
the actual code uses "hg.sr.ht::dispatch" as the section [0][1], so I
thought that the config file is not up-to-date. But since those two
lookups fall back to a default value, it could very well be that
"hg.sr.ht::dispatch" section does not exist at all.
Will send a version two, that corrects my first patch and a second one
that corrects the python code.

[0]: https://hg.sr.ht/~sircmpwn/hg.sr.ht/browse/hgsrht/urls.py?rev=tip#L5
[1]: https://hg.sr.ht/~sircmpwn/hg.sr.ht/browse/hgsrht/submit.py?rev=tip#L74
Details
Message ID
<e62bd6e5-03d0-4a33-9fd9-d0ed38166a86@www.fastmail.com>
In-Reply-To
<20220501145726.kfxjgtuplvrfqah3@xenrox.net> (view parent)
DKIM signature
missing
Download raw message
> While it is true that the config has the "git.sr.ht::dispatch" entry,
> the actual code uses "hg.sr.ht::dispatch" as the section [0][1]

Ah right, I believe that code is wrong indeed.

Thanks for the patches! Merged v2 of this, and the other one, as
f70a9cacb505 and 6584a267226c
Reply to thread Export thread (mbox)