updated config varible name

updated config varible name
This commit is contained in:
Rodrigue Chakode 2020-05-17 21:53:56 +02:00
parent 65309da5fb
commit e7cac1bca9
2 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@ env_variables:
SMTP_VERITY_CERT: true SMTP_VERITY_CERT: true
SMTP_CLIENT_USERNAME: "postmaster@example.com" SMTP_CLIENT_USERNAME: "postmaster@example.com"
SMTP_CLIENT_PASSWORD: "postmasterSecretPassWord" SMTP_CLIENT_PASSWORD: "postmasterSecretPassWord"
ALLOWED_ORIGINS: "127.0.0.1,example.com"
CONTACT_REPLY_EMAIL: "noreply@example.com" CONTACT_REPLY_EMAIL: "noreply@example.com"
CONTACT_REPLY_CC_EMAIL: "contact@example.com" CONTACT_REPLY_BCC_EMAIL: "contact@example.com"
DEMO_URL: "https://demo.example.com/" DEMO_URL: "https://demo.example.com/"
ALLOWED_ORIGINS: "127.0.0.1,example.com"

View File

@ -188,9 +188,9 @@ func SendMail(httpResp http.ResponseWriter, httpReq *http.Request) {
var recipients []string var recipients []string
switch contactRequest.RequestTarget { switch contactRequest.RequestTarget {
case "demo": case "demo":
recipients = []string{contactRequest.Email, viper.GetString("CONTACT_REPLY_CC_EMAIL")} recipients = []string{contactRequest.Email, viper.GetString("CONTACT_REPLY_BCC_EMAIL")}
case "contact": case "contact":
recipients = []string{viper.GetString("CONTACT_REPLY_CC_EMAIL")} recipients = []string{viper.GetString("CONTACT_REPLY_BCC_EMAIL")}
default: default:
log.Infoln("not allowed request type:", contactRequest.RequestTarget) log.Infoln("not allowed request type:", contactRequest.RequestTarget)
httpResp.WriteHeader(http.StatusForbidden) httpResp.WriteHeader(http.StatusForbidden)
@ -236,7 +236,7 @@ func SendMail(httpResp http.ResponseWriter, httpReq *http.Request) {
if err != nil { if err != nil {
log.Infof("error: %s", err.Error()) log.Infof("error: %s", err.Error())
contactResponse.Status = "error" contactResponse.Status = "error"
contactResponse.Message = fmt.Sprintf("An internal error occurred, please try later or send us an email at %s.", viper.GetString("CONTACT_REPLY_CC_EMAIL")) contactResponse.Message = fmt.Sprintf("An internal error occurred, please try later or send us an email at %s.", viper.GetString("CONTACT_REPLY_BCC_EMAIL"))
} else { } else {
contactResponse.Status = "success" contactResponse.Status = "success"
if contactRequest.RequestTarget == "demo" { if contactRequest.RequestTarget == "demo" {