removed unnecessery struct wrapping
This commit is contained in:
@@ -358,7 +358,7 @@ type SMTPConfig struct {
|
|||||||
Port int `form:"port" json:"port"`
|
Port int `form:"port" json:"port"`
|
||||||
Host string `form:"host" json:"host"`
|
Host string `form:"host" json:"host"`
|
||||||
Username string `form:"username" json:"username"`
|
Username string `form:"username" json:"username"`
|
||||||
Password string `form:"password" json:"password,omitempty"`
|
Password string `form:"password" json:"password"`
|
||||||
|
|
||||||
// SMTP AUTH - PLAIN (default) or LOGIN
|
// SMTP AUTH - PLAIN (default) or LOGIN
|
||||||
AuthMethod string `form:"authMethod" json:"authMethod"`
|
AuthMethod string `form:"authMethod" json:"authMethod"`
|
||||||
@@ -413,12 +413,7 @@ func (c SMTPConfig) MarshalJSON() ([]byte, error) {
|
|||||||
return json.Marshal(v)
|
return json.Marshal(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
v := struct {
|
return json.Marshal(alias(c))
|
||||||
alias
|
|
||||||
Password string `json:"password"`
|
|
||||||
}{alias(c), c.Password}
|
|
||||||
|
|
||||||
return json.Marshal(v)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ func TestSettings_DBExport(t *testing.T) {
|
|||||||
valueStr = string(export["value"].([]byte))
|
valueStr = string(export["value"].([]byte))
|
||||||
}
|
}
|
||||||
|
|
||||||
expected := `{"smtp":{"enabled":false,"port":0,"host":"smtp_host","username":"smtp_username","authMethod":"","tls":false,"localName":"","password":""},"backups":{"cron":"* * * * *","cronMaxKeep":0,"s3":{"enabled":true,"bucket":"","region":"","endpoint":"","accessKey":"","forcePathStyle":false}},"s3":{"enabled":false,"bucket":"","region":"","endpoint":"s3_endpoint","accessKey":"","secret":"s3_secret","forcePathStyle":false},"meta":{"appName":"test_app_name","appURL":"","senderName":"","senderAddress":"","hideControls":false},"rateLimits":{"rules":[],"enabled":true},"trustedProxy":{"headers":[],"useLeftmostIP":true},"batch":{"enabled":false,"maxRequests":0,"timeout":15,"maxBodySize":0},"logs":{"maxDays":123,"minLevel":0,"logIP":false,"logAuthId":false}}`
|
expected := `{"smtp":{"enabled":false,"port":0,"host":"smtp_host","username":"smtp_username","password":"","authMethod":"","tls":false,"localName":""},"backups":{"cron":"* * * * *","cronMaxKeep":0,"s3":{"enabled":true,"bucket":"","region":"","endpoint":"","accessKey":"","forcePathStyle":false}},"s3":{"enabled":false,"bucket":"","region":"","endpoint":"s3_endpoint","accessKey":"","secret":"s3_secret","forcePathStyle":false},"meta":{"appName":"test_app_name","appURL":"","senderName":"","senderAddress":"","hideControls":false},"rateLimits":{"rules":[],"enabled":true},"trustedProxy":{"headers":[],"useLeftmostIP":true},"batch":{"enabled":false,"maxRequests":0,"timeout":15,"maxBodySize":0},"logs":{"maxDays":123,"minLevel":0,"logIP":false,"logAuthId":false}}`
|
||||||
if valueStr != expected {
|
if valueStr != expected {
|
||||||
t.Fatalf("Expected exported settings\n%s\ngot\n%s", expected, valueStr)
|
t.Fatalf("Expected exported settings\n%s\ngot\n%s", expected, valueStr)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user