//----------------------------------------------------------------------------- // Test Framework //----------------------------------------------------------------------------- // Initialize func init() { tu.InitializeTest("[Mail]") //encrypt crypt := enc.GetCrypt() mailTo, _ = crypt.DecryptBase64(mailTo) }
// Cipher is to decrypt encrypted value of toml file func Cipher() { crypt := enc.GetCrypt() if conf.Redis.Encrypted { c := conf.Redis c.URL, _ = crypt.DecryptBase64(c.URL) } if conf.Mail.Encrypted { c := conf.Mail c.MailTo, _ = crypt.DecryptBase64(c.MailTo) c.MailFrom, _ = crypt.DecryptBase64(c.MailFrom) c2 := conf.Mail.SMTP c2.Address, _ = crypt.DecryptBase64(c2.Address) c2.Pass, _ = crypt.DecryptBase64(c2.Pass) c2.Server, _ = crypt.DecryptBase64(c2.Server) } }
// Cipher is to decrypt crypted string on config func Cipher() { crypt := enc.GetCrypt() if conf.MySQL.Encrypted { c := conf.MySQL c.Host, _ = crypt.DecryptBase64(c.Host) c.DbName, _ = crypt.DecryptBase64(c.DbName) c.User, _ = crypt.DecryptBase64(c.User) c.Pass, _ = crypt.DecryptBase64(c.Pass) } if conf.Redis.Encrypted { c := conf.Redis c.Host, _ = crypt.DecryptBase64(c.Host) c.Pass, _ = crypt.DecryptBase64(c.Pass) } if conf.Mongo.Encrypted { c := conf.Mongo c.Host, _ = crypt.DecryptBase64(c.Host) c.DbName, _ = crypt.DecryptBase64(c.DbName) c.User, _ = crypt.DecryptBase64(c.User) c.Pass, _ = crypt.DecryptBase64(c.Pass) } if conf.Mail.Encrypted { c := conf.Mail c.Address, _ = crypt.DecryptBase64(c.Address) c.Password, _ = crypt.DecryptBase64(c.Password) c2 := conf.Mail.SMTP c2.Server, _ = crypt.DecryptBase64(c2.Server) } if conf.Aws.Encrypted { c := conf.Aws c.AccessKey, _ = crypt.DecryptBase64(c.AccessKey) c.SecretKey, _ = crypt.DecryptBase64(c.SecretKey) } }