Skip to content

Commit a9075dc

Browse files
committed
add mapstructure for config
1 parent 83597a6 commit a9075dc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

notify.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ type Notify struct {
3232
}
3333

3434
type Config struct {
35-
Platform Platform
36-
Token string
37-
Channel string
38-
Source string
39-
Severity string
40-
User string
41-
Password string
42-
Host string
35+
Platform Platform `mapstructure:"platform"`
36+
Token string `mapstructure:"token"`
37+
Channel string `mapstructure:"channel"`
38+
Source string `mapstructure:"source"`
39+
Severity string `mapstructure:"severity"`
40+
User string `mapstructure:"user"`
41+
Password string `mapstructure:"password"`
42+
Host string `mapstructure:"host"`
4343
}
4444

4545
func NewNotify(config *Config) *Notify {
@@ -69,7 +69,6 @@ func (n *Notify) Send(msg string) error {
6969
default:
7070
return errors.New("not supported notify platform")
7171
}
72-
return nil
7372
}
7473

7574
func (n *Notify) sendPushOverNotify(msg string) error {

0 commit comments

Comments
 (0)