-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lot of work for #14 where the Node interface passes context back to…
… the Schedule.
- Loading branch information
Showing
12 changed files
with
130 additions
and
96 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
|
||
storage: "file" | ||
fileconfig: | ||
file_config: | ||
directory: "../server/" | ||
dbconfig: | ||
db_config: | ||
connection_string: "N/A" | ||
serverconfig: | ||
server_config: | ||
port: "8081" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
package notifier | ||
|
||
func (w Webhook) Send(msg string) { | ||
// var str string | ||
// str = msg | ||
// jv, err := json.Marshal(str) | ||
// if err != nil { | ||
// common.CheckError(err) | ||
// } | ||
// _ , err = http.Post(w.Addr,"application/json", bytes.NewBuffer(jv)) | ||
// common.CheckError(err) | ||
import ( | ||
"sync" | ||
|
||
} | ||
"github.com/att/deadline/config" | ||
) | ||
|
||
var once sync.Once | ||
var notifier *Notifier | ||
|
||
// func NewNotifyHandler(handlerType string, addr string) NotifyHandler { | ||
// GetInstance gets the current running instance of a Notifier class | ||
func GetInstance(cfg *config.Config) *Notifier { | ||
once.Do(func() { | ||
notifier = &Notifier{} | ||
}) | ||
|
||
// switch handlerType { | ||
// case "WEBHOOK": | ||
return notifier | ||
} | ||
|
||
// w := &Webhook{ | ||
// Addr: addr, | ||
// } | ||
// w.TH.Name = handlerType | ||
// Notify is the main API to notify some entity with a message of some kind | ||
func (notifier *Notifier) Notify(notification Notification) { | ||
|
||
// return w | ||
// } | ||
// common.Info.Println("Did not give a valid handler.") | ||
// return &Webhook{} | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
package notifier | ||
import ( | ||
"net/http" | ||
) | ||
package notifier | ||
|
||
type NotifyHandler interface { | ||
Send(string) | ||
type Notifier struct { | ||
} | ||
|
||
type TypeHandler struct { | ||
Name string | ||
} | ||
type Webhook struct { | ||
TH TypeHandler | ||
Addr string | ||
Handler http.Handler | ||
|
||
} | ||
type Notification map[string]string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
package schedule | ||
|
||
// Handle is the email handler's implementation of the Handler interface. | ||
func (h EmailHandlerNode) Handle(ctx *Context) { | ||
func (handler EmailHandlerNode) Handle(ctx *Context) { | ||
// cfg := config.GetEmailConfig() | ||
|
||
// var client *smtp.Client | ||
|
||
} | ||
|
||
// Name is the email handlers implementation of the Node interface. | ||
func (h EmailHandlerNode) Name() string { | ||
return h.name | ||
func (handler EmailHandlerNode) Name() string { | ||
return handler.name | ||
} | ||
|
||
// Next defines what's after this node completes. | ||
func (h EmailHandlerNode) Next() ([]*NodeInstance, *Context) { | ||
return nil, nil | ||
// Next for this type is simply defined. There's no logic computed. It | ||
// return nil context. | ||
func (handler EmailHandlerNode) Next() ([]*NodeInstance, *Context) { | ||
var ret []*NodeInstance | ||
return append(ret, handler.to), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.