removed notifier exports

pull/78/head
Hunter Long 2018-10-05 22:03:10 -07:00
parent 2b2c08ce40
commit 7a859180fe
4 changed files with 20 additions and 20 deletions

View File

@ -157,9 +157,9 @@ func init() {
}
}
// Send will send the SMTP email with your authentication It accepts type: *EmailOutgoing
// Send will send the SMTP email with your authentication It accepts type: *emailOutgoing
func (u *email) Send(msg interface{}) error {
email := msg.(*EmailOutgoing)
email := msg.(*emailOutgoing)
err := u.dialSend(email)
if err != nil {
utils.Log(3, fmt.Sprintf("email Notifier could not send email: %v", err))
@ -168,7 +168,7 @@ func (u *email) Send(msg interface{}) error {
return nil
}
type EmailOutgoing struct {
type emailOutgoing struct {
To string
Subject string
Template string
@ -180,7 +180,7 @@ type EmailOutgoing struct {
// OnFailure will trigger failing service
func (u *email) OnFailure(s *types.Service, f *types.Failure) {
email := &EmailOutgoing{
email := &emailOutgoing{
To: emailer.GetValue("var2"),
Subject: fmt.Sprintf("Service %v is Failing", s.Name),
Template: TEMPLATE,
@ -194,7 +194,7 @@ func (u *email) OnFailure(s *types.Service, f *types.Failure) {
// OnSuccess will trigger successful service
func (u *email) OnSuccess(s *types.Service) {
if !u.Online {
email := &EmailOutgoing{
email := &emailOutgoing{
To: emailer.GetValue("var2"),
Subject: fmt.Sprintf("Service %v is Back Online", s.Name),
Template: TEMPLATE,
@ -229,7 +229,7 @@ func (u *email) OnTest() error {
return dial.Auth(auth)
}
func (u *email) dialSend(email *EmailOutgoing) error {
func (u *email) dialSend(email *emailOutgoing) error {
mailer = mail.NewDialer(emailer.Host, emailer.Port, emailer.Username, emailer.Password)
mailer.TLSConfig = &tls.Config{InsecureSkipVerify: true}
emailSource(email)
@ -245,12 +245,12 @@ func (u *email) dialSend(email *EmailOutgoing) error {
return nil
}
func emailSource(email *EmailOutgoing) {
source := EmailTemplate(email.Template, email.Data)
func emailSource(email *emailOutgoing) {
source := emailTemplate(email.Template, email.Data)
email.Source = source
}
func EmailTemplate(contents string, data interface{}) string {
func emailTemplate(contents string, data interface{}) string {
t := template.New("email")
t, err := t.Parse(contents)
if err != nil {

View File

@ -34,7 +34,7 @@ var (
EMAIL_PORT = utils.StringInt(os.Getenv("EMAIL_PORT"))
)
var testEmail *EmailOutgoing
var testEmail *emailOutgoing
func init() {
EMAIL_HOST = os.Getenv("EMAIL_HOST")
@ -69,7 +69,7 @@ func TestEmailNotifier(t *testing.T) {
emailer.Port = int(EMAIL_PORT)
emailer.Delay = time.Duration(100 * time.Millisecond)
testEmail = &EmailOutgoing{
testEmail = &emailOutgoing{
To: emailer.GetValue("var2"),
Subject: fmt.Sprintf("Service %v is Failing", TestService.Name),
Template: TEMPLATE,

View File

@ -67,7 +67,7 @@ func parseSlackMessage(temp string, data interface{}) error {
return nil
}
type SlackMessage struct {
type slackMessage struct {
Service *types.Service
Template string
Time int64
@ -114,7 +114,7 @@ func (u *slack) OnTest() error {
// OnFailure will trigger failing service
func (u *slack) OnFailure(s *types.Service, f *types.Failure) {
message := SlackMessage{
message := slackMessage{
Service: s,
Template: FAILING_TEMPLATE,
Time: time.Now().Unix(),
@ -126,7 +126,7 @@ func (u *slack) OnFailure(s *types.Service, f *types.Failure) {
// OnSuccess will trigger successful service
func (u *slack) OnSuccess(s *types.Service) {
if !u.Online {
message := SlackMessage{
message := slackMessage{
Service: s,
Template: SUCCESS_TEMPLATE,
Time: time.Now().Unix(),

View File

@ -139,8 +139,8 @@ func (u *twilio) OnTest() error {
return u.Send(msg)
}
func twilioSuccess(res []byte) (bool, TwilioResponse) {
var obj TwilioResponse
func twilioSuccess(res []byte) (bool, twilioResponse) {
var obj twilioResponse
json.Unmarshal(res, &obj)
if obj.Status == "queued" {
return true, obj
@ -148,20 +148,20 @@ func twilioSuccess(res []byte) (bool, TwilioResponse) {
return false, obj
}
func twilioError(res []byte) TwilioError {
var obj TwilioError
func twilioError(res []byte) twilioErrorObj {
var obj twilioErrorObj
json.Unmarshal(res, &obj)
return obj
}
type TwilioError struct {
type twilioErrorObj struct {
Code int `json:"code"`
Message string `json:"message"`
MoreInfo string `json:"more_info"`
Status int `json:"status"`
}
type TwilioResponse struct {
type twilioResponse struct {
Sid string `json:"sid"`
DateCreated string `json:"date_created"`
DateUpdated string `json:"date_updated"`