]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cfg.go
Operations progress
[nncp.git] / src / cfg.go
index 46e6bba6eab537a542f98619a9f19fc86964ed54..615e382410a6f52bd067e40717356a3b9c6e0950 100644 (file)
@@ -98,8 +98,9 @@ type FromToJSON struct {
 }
 
 type NotifyJSON struct {
-       File *FromToJSON `json:"file,omitempty"`
-       Freq *FromToJSON `json:"freq,omitempty"`
+       File *FromToJSON            `json:"file,omitempty"`
+       Freq *FromToJSON            `json:"freq,omitempty"`
+       Exec map[string]*FromToJSON `json:"exec,omitempty"`
 }
 
 type CfgJSON struct {
@@ -107,6 +108,8 @@ type CfgJSON struct {
        Log   string `json:"log"`
        Umask string `json:"umask",omitempty`
 
+       OmitPrgrs bool `json:"noprogress",omitempty`
+
        Notify *NotifyJSON `json:"notify,omitempty"`
 
        Self  *NodeOurJSON        `json:"self"`
@@ -422,10 +425,15 @@ func CfgParse(data []byte) (*Ctx, error) {
                rInt := int(r)
                umaskForce = &rInt
        }
+       showPrgrs := true
+       if cfgJSON.OmitPrgrs {
+               showPrgrs = false
+       }
        ctx := Ctx{
                Spool:      spoolPath,
                LogPath:    logPath,
                UmaskForce: umaskForce,
+               ShowPrgrs:  showPrgrs,
                Self:       self,
                Neigh:      make(map[NodeId]*Node, len(cfgJSON.Neigh)),
                Alias:      make(map[string]*NodeId),
@@ -437,6 +445,9 @@ func CfgParse(data []byte) (*Ctx, error) {
                if cfgJSON.Notify.Freq != nil {
                        ctx.NotifyFreq = cfgJSON.Notify.Freq
                }
+               if cfgJSON.Notify.Exec != nil {
+                       ctx.NotifyExec = cfgJSON.Notify.Exec
+               }
        }
        vias := make(map[NodeId][]string)
        for name, neighJSON := range cfgJSON.Neigh {