Skip to content

Commit

Permalink
beego updated v2
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Iscar <[email protected]>
  • Loading branch information
juaismar committed Oct 4, 2022
1 parent 4d522d5 commit 04aa974
Show file tree
Hide file tree
Showing 7 changed files with 379 additions and 87 deletions.
17 changes: 6 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@ module github.com/mapreal19/beemiel
go 1.15

require (
github.com/astaxie/beego v1.12.3
github.com/beego/beego/v2 v2.0.5
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/gobuffalo/envy v1.10.1 // indirect
github.com/mailgun/mailgun-go v2.0.0+incompatible // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/mailgun/mailgun-go v2.0.0+incompatible
github.com/o1egl/paseto v1.0.0
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.7.1
github.com/prometheus/client_golang v1.9.0 // indirect
github.com/sendgrid/rest v2.6.2+incompatible // indirect
github.com/sendgrid/sendgrid-go v3.7.0+incompatible
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
github.com/slack-go/slack v0.7.2
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 // indirect
golang.org/x/text v0.3.4 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
)
425 changes: 361 additions & 64 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions gomega/matcher/flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"regexp"

"github.com/astaxie/beego"
"github.com/beego/beego/v2/server/web"
"github.com/onsi/gomega/types"
)

Expand Down Expand Up @@ -61,7 +61,7 @@ func (matcher *setFlashMatcher) NegatedFailureMessage(actual interface{}) (messa

func findFlashCookie(response *httptest.ResponseRecorder) *http.Cookie {
for _, cookie := range response.Result().Cookies() {
if cookie.Name == beego.BConfig.WebConfig.FlashName {
if cookie.Name == web.BConfig.WebConfig.FlashName {
return cookie
}
}
Expand All @@ -70,15 +70,15 @@ func findFlashCookie(response *httptest.ResponseRecorder) *http.Cookie {

func getFlashLevel(response *httptest.ResponseRecorder) string {
cookie := findFlashCookie(response)
regexExpression, _ := regexp.Compile("%00(.*)%23" + beego.BConfig.WebConfig.FlashSeparator)
regexExpression, _ := regexp.Compile("%00(.*)%23" + web.BConfig.WebConfig.FlashSeparator)
level := regexExpression.FindStringSubmatch(cookie.Value)[1]

return level
}

func getFlashMessage(response *httptest.ResponseRecorder) string {
cookie := findFlashCookie(response)
regexExpression, _ := regexp.Compile(beego.BConfig.WebConfig.FlashSeparator + "%23(.*)%00")
regexExpression, _ := regexp.Compile(web.BConfig.WebConfig.FlashSeparator + "%23(.*)%00")
message := regexExpression.FindStringSubmatch(cookie.Value)[1]

messageUnescaped, _ := url.QueryUnescape(message)
Expand Down
4 changes: 2 additions & 2 deletions notification/mailer/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mailer
import (
"fmt"

"github.com/astaxie/beego"
"github.com/beego/beego/v2/core/logs"
"github.com/mapreal19/beemiel/envs"
)

Expand Down Expand Up @@ -77,7 +77,7 @@ func (e *emailSender) Send(email Email) error {
email.Tos[0],
email.Subject,
)
beego.Info(message)
logs.Info(message)
}
return e.send(email)
}
4 changes: 2 additions & 2 deletions notification/mailer/mailgun.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mailer
import (
"fmt"

"github.com/astaxie/beego"
"github.com/beego/beego/v2/core/logs"
"github.com/mailgun/mailgun-go"
)

Expand Down Expand Up @@ -32,7 +32,7 @@ func newMailgunSender(g globalConf) *emailSender {
}

func (m *mailGun) mailgunSender(email Email) error {
beego.Info("Sending email through MailGun... Recipient: ", email.Tos[0])
logs.Info("Sending email through MailGun... Recipient: ", email.Tos[0])
mg := mailgun.NewMailgun(m.Domain, m.ApiKey)
m.setRegion(mg, m.Region)

Expand Down
4 changes: 2 additions & 2 deletions notification/mailer/sengrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mailer
import (
"encoding/base64"

"github.com/astaxie/beego"
"github.com/beego/beego/v2/core/logs"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
)
Expand All @@ -21,7 +21,7 @@ func newSengridSender(g globalConf) *emailSender {
}

func (s *sendGrid) sengridSender(email Email) error {
beego.Info("Sending email through Sendgrid... Recipient: ", email.Tos[0])
logs.Info("Sending email through Sendgrid... Recipient: ", email.Tos[0])

fromMail := mail.NewEmail(email.FromName, email.From)

Expand Down
4 changes: 2 additions & 2 deletions notification/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package slack
import (
"fmt"

"github.com/astaxie/beego"
"github.com/beego/beego/v2/core/logs"
"github.com/mapreal19/beemiel/envs"
"github.com/slack-go/slack"
)
Expand Down Expand Up @@ -59,7 +59,7 @@ func (e *slackSender) Send(message Message) error {
message.Channel,
message.Header,
)
beego.Info(text)
logs.Info(text)
}

return e.send(message)
Expand Down

0 comments on commit 04aa974

Please sign in to comment.