commit 27619bd7049a7757cf6ef7a3ae84c20b1254a4f1
parent a2adca06e7ceb3db876bc7ec7ac9ee8d731ff297
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Tue, 14 Jan 2025 16:14:06 +0100
add validator type
Diffstat:
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
@@ -114,11 +114,21 @@ type Taldir struct {
I18n *i18n.I18n
}
+type ValidatorType string
+
+const (
+ ValidatorTypeCommand ValidatorType = "command"
+ ValidatorTypeOIDC ValidatorType = "oidc"
+)
+
type Validator struct {
- // Amount of payment required
+ // Validator name
Name string
+ // Validator type
+ Type ValidatorType
+
// Amount of payment required
ChallengeFee string
@@ -788,8 +798,8 @@ func (t *Taldir) Initialize(cfgfile string, version string) {
if !strings.HasPrefix(sec.Name(), "taldir-validator-") {
continue
}
- if !sec.HasKey("enabled") {
- log.Printf("`enabled` key in section `[%s]` not found, disabling validator.\n", sec.Name())
+ if !sec.HasKey("type") {
+ log.Printf("`type` key in section `[%s]` not found, disabling validator.\n", sec.Name())
continue
}
vname := strings.TrimPrefix(sec.Name(), "taldir-validator-")
@@ -805,6 +815,7 @@ func (t *Taldir) Initialize(cfgfile string, version string) {
ChallengeFee: sec.Key("challenge_fee").MustString("KUDOS:0"),
PaymentRequired: sec.Key("enabled").MustBool(false),
Command: sec.Key("command").MustString(""),
+ Type: ValidatorType(sec.Key("type").MustString("")),
}
}
t.ChallengeBytes = t.Cfg.Section("taldir").Key("challenge_bytes").MustInt(16)