gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taldir] branch master updated: Fix bug with validator config parsing co


From: Admin
Subject: [taldir] branch master updated: Fix bug with validator config parsing conflating enabled flag with payment required. This commit removes the payment_required setting for validators and properly handles the enabled boolean for validators. Also adds enabling and disabling of disseminators using enabled boolean key in repsective config sections.
Date: Fri, 13 Jun 2025 22:22:29 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository taldir.

The following commit(s) were added to refs/heads/master by this push:
     new bc77582  Fix bug with validator config parsing conflating enabled flag 
with payment required. This commit removes the payment_required setting for 
validators and properly handles the enabled boolean for validators. Also adds 
enabling and disabling of disseminators using enabled boolean key in repsective 
config sections.
bc77582 is described below

commit bc7758224ea4fceba8ce04004a65fd02a3bbf00e
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Jun 13 22:21:10 2025 +0200

    Fix bug with validator config parsing conflating enabled flag with
    payment required.
    This commit removes the payment_required setting for validators and
    properly handles the enabled boolean for validators.
    Also adds enabling and disabling of disseminators using enabled boolean
    key in repsective config sections.
---
 pkg/rest/taldir.go | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index a9b82db..f2c12c6 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -170,9 +170,6 @@ type Validator struct {
        // Amount of payment required
        ChallengeFee string
 
-       // Does this validator require payment
-       PaymentRequired bool
-
        // The command to call for validation
        Command string
 
@@ -1044,11 +1041,19 @@ func (t *Taldir) Initialize(cfg TaldirConfig) {
                if !strings.HasPrefix(sec.Name(), "taldir-validator-") {
                        continue
                }
+               if !sec.HasKey("enabled") {
+                       t.Logger.Printf("`enabled` key in section `[%s]` not 
found, disabling validator.\n", sec.Name())
+                       continue
+               }
                if !sec.HasKey("type") {
                        t.Logger.Printf("`type` key in section `[%s]` not 
found, disabling validator.\n", sec.Name())
                        continue
                }
                vname := strings.TrimPrefix(sec.Name(), "taldir-validator-")
+               if !sec.Key("enabled").MustBool(false) {
+                       t.Logger.Printf("`%s` validator disabled.\n", vname)
+                       continue
+               }
                vlandingPageTplFile := 
sec.Key("registration_page").MustString(t.getFileName("web/templates/landing_" 
+ vname + ".html"))
                vlandingPageTpl, err := 
template.ParseFiles(vlandingPageTplFile, navTplFile, footerTplFile)
                if err != nil {
@@ -1059,7 +1064,6 @@ func (t *Taldir) Initialize(cfg TaldirConfig) {
                        Name:            vname,
                        LandingPageTpl:  vlandingPageTpl,
                        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("")),
                        ValidAliasRegex: 
sec.Key("valid_alias_regex").MustString(""),
@@ -1071,6 +1075,14 @@ func (t *Taldir) Initialize(cfg TaldirConfig) {
                        continue
                }
                dname := strings.TrimPrefix(sec.Name(), "taldir-disseminator-")
+               if !sec.HasKey("enabled") {
+                       t.Logger.Printf("`enabled` key in section `[%s]` not 
found, disabling disseminator.\n", sec.Name())
+                       continue
+               }
+               if !sec.Key("enabled").MustBool(false) {
+                       t.Logger.Printf("`%s` disseminator disabled.\n", dname)
+                       continue
+               }
                t.Disseminators[dname] = Disseminator{
                        Name:            dname,
                        Command:         sec.Key("command").MustString(""),

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]