Fix test notification cli command
Also, addresses issue with SMTP_* env vars value, which were ignored on server startup.
This commit is contained in:
@@ -731,8 +731,6 @@ func applySmtpOptionsToSettings(ctx context.Context, log *zap.Logger, opt option
|
||||
"To avoid confusion and potential issues, we suggest you to " +
|
||||
"remove all SMTP_* variables")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// SMTP server settings do not exist but
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
type (
|
||||
serviceInitializer interface {
|
||||
InitServices(ctx context.Context) error
|
||||
Activate(ctx context.Context) error
|
||||
Options() *options.Options
|
||||
}
|
||||
)
|
||||
@@ -28,6 +29,12 @@ func commandPreRunInitService(app serviceInitializer) func(*cobra.Command, []str
|
||||
}
|
||||
}
|
||||
|
||||
func commandPreRunInitActivate(app serviceInitializer) func(*cobra.Command, []string) error {
|
||||
return func(_ *cobra.Command, _ []string) error {
|
||||
return app.Activate(cli.Context())
|
||||
}
|
||||
}
|
||||
|
||||
func Command(ctx context.Context, app serviceInitializer, storeInit func(ctx context.Context) (store.Storer, error)) *cobra.Command {
|
||||
var (
|
||||
enableDiscoveredProvider bool
|
||||
@@ -151,7 +158,7 @@ func Command(ctx context.Context, app serviceInitializer, storeInit func(ctx con
|
||||
Use: "test-notifications [recipient]",
|
||||
Short: "Sends samples of all authentication notification to recipient",
|
||||
Args: cobra.ExactArgs(1),
|
||||
PreRunE: commandPreRunInitService(app),
|
||||
PreRunE: commandPreRunInitActivate(app),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var (
|
||||
err error
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ func New() *gomail.Message {
|
||||
return message
|
||||
}
|
||||
|
||||
// Sends message with SMTP dialer
|
||||
// Send message with SMTP dialer
|
||||
func Send(message *gomail.Message, dd ...Dialer) (err error) {
|
||||
for _, d := range append(dd, defaultDialer) {
|
||||
if d == nil {
|
||||
|
||||
Reference in New Issue
Block a user