diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/auth/group.go | 5 | ||||
-rw-r--r-- | services/auth/interface.go | 2 | ||||
-rw-r--r-- | services/auth/sspi_windows.go | 12 | ||||
-rw-r--r-- | services/mailer/mailer.go | 5 |
4 files changed, 10 insertions, 14 deletions
diff --git a/services/auth/group.go b/services/auth/group.go index 0f40e1a76c..bbafe64b49 100644 --- a/services/auth/group.go +++ b/services/auth/group.go @@ -5,6 +5,7 @@ package auth import ( + "context" "net/http" "reflect" "strings" @@ -51,14 +52,14 @@ func (b *Group) Name() string { } // Init does nothing as the Basic implementation does not need to allocate any resources -func (b *Group) Init() error { +func (b *Group) Init(ctx context.Context) error { for _, method := range b.methods { initializable, ok := method.(Initializable) if !ok { continue } - if err := initializable.Init(); err != nil { + if err := initializable.Init(ctx); err != nil { return err } } diff --git a/services/auth/interface.go b/services/auth/interface.go index a05ece2078..ecc9ad2ca6 100644 --- a/services/auth/interface.go +++ b/services/auth/interface.go @@ -34,7 +34,7 @@ type Method interface { type Initializable interface { // Init should be called exactly once before using any of the other methods, // in order to allow the plugin to allocate necessary resources - Init() error + Init(ctx context.Context) error } // Named represents a named thing diff --git a/services/auth/sspi_windows.go b/services/auth/sspi_windows.go index 7e31378b6c..757d596c4c 100644 --- a/services/auth/sspi_windows.go +++ b/services/auth/sspi_windows.go @@ -5,6 +5,7 @@ package auth import ( + "context" "errors" "net/http" "strings" @@ -52,21 +53,14 @@ type SSPI struct { } // Init creates a new global websspi.Authenticator object -func (s *SSPI) Init() error { +func (s *SSPI) Init(ctx context.Context) error { config := websspi.NewConfig() var err error sspiAuth, err = websspi.New(config) if err != nil { return err } - s.rnd = render.New(render.Options{ - Extensions: []string{".tmpl"}, - Directory: "templates", - Funcs: templates.NewFuncMap(), - Asset: templates.GetAsset, - AssetNames: templates.GetAssetNames, - IsDevelopment: !setting.IsProd, - }) + _, s.rnd = templates.HTMLRenderer(ctx) return nil } diff --git a/services/mailer/mailer.go b/services/mailer/mailer.go index fdbb6e562b..1f43c7f827 100644 --- a/services/mailer/mailer.go +++ b/services/mailer/mailer.go @@ -7,6 +7,7 @@ package mailer import ( "bytes" + "context" "crypto/tls" "fmt" "hash/fnv" @@ -348,7 +349,7 @@ var mailQueue queue.Queue var Sender gomail.Sender // NewContext start mail queue service -func NewContext() { +func NewContext(ctx context.Context) { // Need to check if mailQueue is nil because in during reinstall (user had installed // before but switched install lock off), this function will be called again // while mail queue is already processing tasks, and produces a race condition. @@ -381,7 +382,7 @@ func NewContext() { go graceful.GetManager().RunWithShutdownFns(mailQueue.Run) - subjectTemplates, bodyTemplates = templates.Mailer() + subjectTemplates, bodyTemplates = templates.Mailer(ctx) } // SendAsync send mail asynchronously |