-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inject a noop slack client in case no slack token is set (#13)
Fixes #12
- Loading branch information
1 parent
02d875a
commit fdd7998
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package slack | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
type noopClient struct{} | ||
|
||
func (c *noopClient) SendMessages(channels []string, text, context string) (map[string]string, error) { | ||
if len(channels) > 0 { | ||
log.Debugf("Slack disabled. Would've sent the following message: %s", text) | ||
} | ||
return nil, nil | ||
} | ||
|
||
func (c *noopClient) UpdateMessages(slackMessages map[string]string, text, context string) error { | ||
if len(slackMessages) > 0 { | ||
log.Debugf("Slack disabled. Would've updated messages to: %s", text) | ||
} | ||
return nil | ||
} | ||
|
||
func (c *noopClient) AddFileToThreads(slackMessages map[string]string, fileName, content string) error { | ||
if len(slackMessages) > 0 { | ||
log.Debugf("Slack disabled. Would've uploaded file named: %s", fileName) | ||
} | ||
return nil | ||
} |