Skip to content

Commit

Permalink
Merge pull request CLIP-HPC#29 from CLIP-HPC/23-dumpconfig-will-print…
Browse files Browse the repository at this point in the history
…-out-tokens

add: debugconfig flag to control dumping of configuration at startup
  • Loading branch information
pja237 authored Feb 11, 2023
2 parents 1d3d9a5 + f874ce7 commit d60a3ea
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 9 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

> **News & Info**
>
>### [Discussion forums](https://github.com/CLIP-HPC/goslmailer/discussions) have been enabled for this project, feel free to share your thoughts and ideas there.
>
> v2.7.1
>
> * In v2.7.0 dumping of configuration at goslmailer/gobler startup was removed.
> * Now it can be selectively enabled with `debugconfig: true` parameter in [config file](./cmd/goslmailer/goslmailer.conf.annotated_example)
>
>
> v2.7.0
>
> * [slack connector](#slack-connector)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.7.0
v2.7.1
2 changes: 1 addition & 1 deletion cmd/gobler/gobler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func main() {

version.DumpVersion(l)

// cfg.DumpConfig(l)
cfg.DumpConfig(l)

// populate map with configured referenced connectors
err = connectors.ConMap.PopulateConnectors(cfg, l)
Expand Down
1 change: 1 addition & 0 deletions cmd/goslmailer/goslmailer.conf.annotated_example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ # don't forget to remove the '#' comments if using this template
"logfile": "/tmp/goslmailer.log", # if specified; append logs to this file; else; dump to stderr
"debugconfig": true, # if specified and true ; goslmailer and gobler will dump configuration to log; else; they won't
"binpaths": { # paths to slurm binaries (optional, will default to these if not specified)
"sacct":"/usr/bin/sacct",
"sstat":"/usr/bin/sstat"
Expand Down
4 changes: 2 additions & 2 deletions cmd/goslmailer/goslmailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
_ "github.com/CLIP-HPC/goslmailer/connectors/matrix"
_ "github.com/CLIP-HPC/goslmailer/connectors/mattermost"
_ "github.com/CLIP-HPC/goslmailer/connectors/msteams"
_ "github.com/CLIP-HPC/goslmailer/connectors/telegram"
_ "github.com/CLIP-HPC/goslmailer/connectors/slack"
_ "github.com/CLIP-HPC/goslmailer/connectors/telegram"
"github.com/CLIP-HPC/goslmailer/internal/config"
"github.com/CLIP-HPC/goslmailer/internal/connectors"
"github.com/CLIP-HPC/goslmailer/internal/logger"
Expand Down Expand Up @@ -51,7 +51,7 @@ func main() {

version.DumpVersion(l)

// cfg.DumpConfig(l)
cfg.DumpConfig(l)

// get '-s "subject" userid' command line parameters with which we're called
ic.getCMDLine()
Expand Down
3 changes: 3 additions & 0 deletions cmd/goslmailer/goslmailer.toml.annotated_example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# if specified; append logs to this file; else; dump to stderr
logfile = "/tmp/goslmailer.log"

# if specified and true ; goslmailer and gobler will dump configuration to log; else; they won't
debugconfig = true

# default connector to be used for message delivery for receivers without full 'connector:user' specification
defaultconnector = "msteams"

Expand Down
11 changes: 7 additions & 4 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

type ConfigContainer struct {
DebugConfig bool `json:"debugconfig"`
Logfile string `json:"logfile"`
Binpaths map[string]string `json:"binpaths"`
DefaultConnector string `json:"defaultconnector"`
Expand Down Expand Up @@ -73,8 +74,10 @@ func (cc *ConfigContainer) testNsetBinPaths() error {
}

func (cc *ConfigContainer) DumpConfig(l *log.Logger) {
l.Println("DUMP CONFIG:")
l.Printf("CONFIGURATION: %#v\n", cc)
l.Printf("CONFIGURATION logfile: %s\n", cc.Logfile)
l.Println("--------------------------------------------------------------------------------")
if cc.DebugConfig {
l.Printf("DUMP CONFIG:\n")
l.Printf("CONFIGURATION: %#v\n", cc)
l.Printf("CONFIGURATION logfile: %s\n", cc.Logfile)
l.Printf("--------------------------------------------------------------------------------\n")
}
}
1 change: 1 addition & 0 deletions test_e2e/cases/test_01/conf/goslmailer.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"debugconfig":true,
"logfile": "",
"defaultconnector": "msteams",
"binpaths": {
Expand Down
2 changes: 1 addition & 1 deletion test_e2e/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ init:

pipeline:
loop_over_tests:
range: 01..06
range: 00..06
subPath: cases/test_${index}
template:

Expand Down

0 comments on commit d60a3ea

Please sign in to comment.