Skip to content

Commit

Permalink
Make the config path configurable. Closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
csmith committed Sep 17, 2020
1 parent 6de3763 commit 30d6d80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/goplum/goplum.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

var (
pluginsDir = flag.String("plugins", "plugins", "Directory to load plugins from")
configPath = flag.String("config", "config.json", "Path to the config file")
)

func main() {
Expand All @@ -26,6 +27,6 @@ func main() {

plum := &goplum.Plum{}
plum.AddPlugins(plugins)
plum.LoadConfig("config.json")
plum.LoadConfig(*configPath)
plum.Run()
}
7 changes: 6 additions & 1 deletion cmd/goplumdev/goplumdev.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"github.com/csmith/goplum"
"github.com/csmith/goplum/plugins/debug"
"github.com/csmith/goplum/plugins/http"
Expand All @@ -10,6 +11,10 @@ import (
"log"
)

var (
configPath = flag.String("config", "config.json", "Path to the config file")
)

func main() {
if err := envflag.Parse(); err != nil {
panic(err)
Expand All @@ -29,6 +34,6 @@ func main() {

plum := &goplum.Plum{}
plum.AddPlugins(plugins)
plum.LoadConfig("config.json")
plum.LoadConfig(*configPath)
plum.Run()
}
2 changes: 1 addition & 1 deletion plugins/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (w WebHookAlert) Send(details goplum.AlertDetails) error {
return err
}

res, err := http.Post(w.params.Url, "application/json", bytes.NewReader(b))
res, err := client.Post(w.params.Url, "application/json", bytes.NewReader(b))
if err != nil {
return err
}
Expand Down

0 comments on commit 30d6d80

Please sign in to comment.