Skip to content

Commit

Permalink
refactor: plugin email without auth
Browse files Browse the repository at this point in the history
  • Loading branch information
wI2L committed Jul 27, 2020
1 parent a596736 commit e4c979e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
30 changes: 15 additions & 15 deletions pkg/plugins/builtin/email/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}}
Expand Down Expand Up @@ -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
- `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
8 changes: 0 additions & 8 deletions pkg/plugins/builtin/email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit e4c979e

Please sign in to comment.