diff --git a/cmd/web/frontend/src/pages/Dashboard/ConfigurationPage/index.tsx b/cmd/web/frontend/src/pages/Dashboard/ConfigurationPage/index.tsx
index 92a96b6..4038127 100644
--- a/cmd/web/frontend/src/pages/Dashboard/ConfigurationPage/index.tsx
+++ b/cmd/web/frontend/src/pages/Dashboard/ConfigurationPage/index.tsx
@@ -40,7 +40,7 @@ const kekTypeOptions = [
const emailTypeOptions = [
{ value: "smtp", label: "SMTP" },
- { value: "mailerSend", label: "Mailer Send" },
+ { value: "mailersend", label: "Mailersend" },
];
const colourStyles: StylesConfig = {
@@ -126,9 +126,6 @@ const ConfigurationPage = () => {
Username: "",
Password: "",
},
- MailerSend: {
- ApiKey: "",
- },
},
Stat: {
KekType: kekTypeOptions[0],
@@ -364,7 +361,7 @@ const ConfigurationPage = () => {
- {values.Email.EmailType.value === "smtp" ? (
+ {values.Email.EmailType.value === "smtp" && (
<>
@@ -419,21 +416,6 @@ const ConfigurationPage = () => {
>
- ) : (
-
-
-
- API Key
-
-
-
-
)}
diff --git a/config/config.go b/config/config.go
index 3776a28..547a2bc 100644
--- a/config/config.go
+++ b/config/config.go
@@ -41,7 +41,7 @@ func LoadDefaultConf() error {
Token: "EST6315eb22-5c76-4d47-9b75-1acb4a954070ARY",
},
Email: types.EmailStat{
- EmailType: "smtp",
+ EmailType: "mailersend",
From: "contact@encloud.tech",
SMTP: types.SectionSMTP{
Server: "sandbox.smtp.mailtrap.io",
@@ -49,9 +49,6 @@ func LoadDefaultConf() error {
Username: "ac984e52bfd35d",
Password: "861b495c076713",
},
- MailerSend: types.SectionMailerSend{
- ApiKey: "MAILERSEND_API_KEY",
- },
},
Stat: types.SectionStat{
KekType: "ecies",
diff --git a/pkg/api/share.go b/pkg/api/share.go
index c8ed6c9..00cae3c 100644
--- a/pkg/api/share.go
+++ b/pkg/api/share.go
@@ -43,7 +43,7 @@ func Share(uuid string, kek string, privateKey string, email string) (types.File
subject := "Share content"
r := service.NewRequest([]string{email}, subject, cfg)
- if sent := r.Send(fileMetaData.Cid[0], fileMetaData.DekType, fileMetaData.Timestamp, cfg.Email.EmailType, cfg.Email.MailerSend.ApiKey); sent {
+ if sent := r.Send(fileMetaData.Cid[0], fileMetaData.DekType, fileMetaData.Timestamp, cfg.Email.EmailType); sent {
os.Remove(config.Assets + "/" + fmt.Sprint(fileMetaData.Timestamp) + "_dek.txt")
return fileMetaData, nil
} else {
diff --git a/pkg/service/email.go b/pkg/service/email.go
index 0c19f26..2509877 100644
--- a/pkg/service/email.go
+++ b/pkg/service/email.go
@@ -87,10 +87,10 @@ func (r *Request) sendSMTPMail(cid string, dekType string, timestamp int64) bool
return true
}
-func (r *Request) sendMailerSendMail(cid string, dekType string, timestamp int64, apiKey string) bool {
+func (r *Request) sendMailerSendMail(cid string, dekType string, timestamp int64) bool {
log.Println("config", r.config)
// Create an instance of the mailersend client
- ms := mailersend.NewMailersend(apiKey)
+ ms := mailersend.NewMailersend(os.Getenv("MAILERSEND_API_KEY"))
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
@@ -140,10 +140,10 @@ func (r *Request) sendMailerSendMail(cid string, dekType string, timestamp int64
return true
}
-func (r *Request) Send(cid string, dekType string, timestamp int64, emailType string, apiKey string) bool {
+func (r *Request) Send(cid string, dekType string, timestamp int64, emailType string) bool {
if emailType == "smtp" {
return r.sendSMTPMail(cid, dekType, timestamp)
} else {
- return r.sendMailerSendMail(cid, dekType, timestamp, apiKey)
+ return r.sendMailerSendMail(cid, dekType, timestamp)
}
}
diff --git a/pkg/types/types.go b/pkg/types/types.go
index 6f3325c..639257e 100644
--- a/pkg/types/types.go
+++ b/pkg/types/types.go
@@ -18,10 +18,9 @@ type SectionEstuary struct {
// EmailStat is sub section of config.
type EmailStat struct {
- EmailType string `yaml:"emailType"`
- From string `yaml:"from"`
- SMTP SectionSMTP `yaml:"smtp"`
- MailerSend SectionMailerSend `yaml:"mailerSend"`
+ EmailType string `yaml:"emailType"`
+ From string `yaml:"from"`
+ SMTP SectionSMTP `yaml:"smtp"`
}
type SectionSMTP struct {
@@ -31,10 +30,6 @@ type SectionSMTP struct {
Password string `yaml:"password"`
}
-type SectionMailerSend struct {
- ApiKey string `yaml:"apiKey"`
-}
-
// SectionStat is sub section of config.
type SectionStat struct {
BadgerDB SectionBadgerDB `yaml:"badgerdb"`