From 1dcf9f4becc0f534d7104d453fe593e16ac68ee2 Mon Sep 17 00:00:00 2001 From: William Poussier Date: Mon, 27 Jul 2020 16:18:47 +0200 Subject: [PATCH] refactor: plugin email without auth Signed-off-by: William Poussier --- pkg/plugins/builtin/email/README.md | 30 ++++++++++++++--------------- pkg/plugins/builtin/email/email.go | 8 -------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/pkg/plugins/builtin/email/README.md b/pkg/plugins/builtin/email/README.md index 8274d0c4..d6adab97 100644 --- a/pkg/plugins/builtin/email/README.md +++ b/pkg/plugins/builtin/email/README.md @@ -4,18 +4,18 @@ This plugin send an email. ## Configuration -|Fields|Description -|---|--- -| `smtp_username` | username of SMTP server -| `smtp_password` | password of SMTP server -| `smtp_port` | port of SMTP server -| `smtp_hostname` | hostname of SMTP server -| `smtp_skip_tls_verif` | Skip or not TLS insecure verify -| `from_address` | from which email you want to send the message -| `from_name` | from which name you want to send the message -| `to` | receiver(s) of your email -| `subject` | subject of your email -| `body` | content of your email +| Fields | Description | +| --------------------- | --------------------------------------------- | +| `smtp_username` | username of SMTP server | +| `smtp_password` | password of SMTP server | +| `smtp_port` | port of SMTP server | +| `smtp_hostname` | hostname of SMTP server | +| `smtp_skip_tls_verif` | Skip or not TLS insecure verify | +| `from_address` | from which email you want to send the message | +| `from_name` | from which name you want to send the message | +| `to` | receiver(s) of your email | +| `subject` | subject of your email | +| `body` | content of your email | ## Example @@ -25,9 +25,9 @@ An action of type `email` requires the following kind of configuration: action: type: email configuration: - # mandatory, string + # optional, string, leave empty for no auth smtp_username: {{.config.smtp.username}} - # mandatory, string + # optional, string, leave empty for no auth smtp_password: {{.config.smtp.password}} # mandatory, string as uint smtp_port: {{.config.smtp.port}} @@ -68,4 +68,4 @@ Sensitive data should be retrieved from configstore and accessed through `{{.con The `email` plugin declares automatically resources for its steps: - `socket` to rate-limit concurrent execution on the number of open outgoing sockets -- `url:smtp_hostname` (where `smtp_hostname` is the outgoing SMTP server of the plugin configuration) to rate-limit concurrent execution on a specific outgoing SMTP server \ No newline at end of file +- `url:smtp_hostname` (where `smtp_hostname` is the outgoing SMTP server of the plugin configuration) to rate-limit concurrent execution on a specific outgoing SMTP server diff --git a/pkg/plugins/builtin/email/email.go b/pkg/plugins/builtin/email/email.go index dd045116..38204178 100644 --- a/pkg/plugins/builtin/email/email.go +++ b/pkg/plugins/builtin/email/email.go @@ -41,14 +41,6 @@ type Config struct { func validConfig(config interface{}) error { cfg := config.(*Config) - if cfg.SMTPUsername == "" { - return errors.New("smtp_username is missing") - } - - if cfg.SMTPPassword == "" { - return errors.New("smtp_password is missing") - } - if cfg.SMTPPort == "" { return errors.New("smtp_port is missing") }