Browse Source

- further rename of config values

flashmob 9 years ago
parent
commit
915246b27b
2 changed files with 13 additions and 10 deletions
  1. 7 7
      config.go
  2. 6 3
      save_mail.go

+ 7 - 7
config.go

@@ -11,14 +11,14 @@ import (
 )
 
 type GlobalConfig struct {
-	Allowed_hosts        string         `json:"GM_ALLOWED_HOSTS"`
-	Primary_host         string         `json:"GM_PRIMARY_MAIL_HOST"`
+	Allowed_hosts        string         `json:"allowed_hosts"`
+	Primary_host         string         `json:"primary_mail_host"`
 	Verbose              bool           `json:"verbose"`
-	Mysql_table          string         `json:"GM_MAIL_TABLE"`
-	Mysql_db             string         `json:"MYSQL_DB"`
-	Mysql_host           string         `json:"MYSQL_HOST"`
-	Mysql_pass           string         `json:"MYSQL_PASS"`
-	Mysql_user           string         `json:"MYSQL_USER"`
+	Mysql_table          string         `json:"mail_table"`
+	Mysql_db             string         `json:"mysql_db"`
+	Mysql_host           string         `json:"mysql_host"`
+	Mysql_pass           string         `json:"mysql_pass"`
+	Mysql_user           string         `json:"mysql_user"`
 	Servers              []ServerConfig `json:"servers"`
 	Pid_file             string         `json:"pid_file,omitempty"`
 	Save_workers_size    int            `json:"save_workers_size"`

+ 6 - 3
save_mail.go

@@ -3,6 +3,7 @@ package main
 import (
 	"github.com/garyburd/redigo/redis"
 	"github.com/ziutek/mymysql/autorc"
+	_ "github.com/ziutek/mymysql/godrv"
 	"log"
 	"fmt"
 	"strconv"
@@ -38,8 +39,8 @@ func saveMail() {
 		mainConfig.Mysql_db)
 	db.Register("set names utf8")
 	sql := "INSERT INTO " + mainConfig.Mysql_table + " "
-	sql += "(`date`, `to`, `from`, `subject`, `body`, `charset`, `mail`, `spam_score`, `hash`, `content_type`, `recipient`, `has_attach`, `ip_addr`, `return_path`)"
-	sql += " values (NOW(), ?, ?, ?, ? , 'UTF-8' , ?, 0, ?, '', ?, 0, ?, ?)"
+	sql += "(`date`, `to`, `from`, `subject`, `body`, `charset`, `mail`, `spam_score`, `hash`, `content_type`, `recipient`, `has_attach`, `ip_addr`, `return_path`, `is_tls`)"
+	sql += " values (NOW(), ?, ?, ?, ? , 'UTF-8' , ?, 0, ?, '', ?, 0, ?, ?, ?)"
 	ins, sql_err := db.Prepare(sql)
 	if sql_err != nil {
 		log.Fatalf(fmt.Sprintf("Sql statement incorrect: %s\n", sql_err))
@@ -95,7 +96,9 @@ func saveMail() {
 			payload.client.hash,
 			recipient,
 			payload.client.address,
-			payload.client.mail_from)
+			payload.client.mail_from,
+			payload.client.tls_on,
+		)
 		// save, discard result
 		_, _, err = ins.Exec()
 		if err != nil {