add default values for SSH settings (#500)

This commit is contained in:
Lunny Xiao 2016-12-29 04:51:15 -06:00 committed by Thomas Boerger
parent 799d0c2030
commit ac51caa517

View file

@ -79,7 +79,7 @@ var (
LandingPageURL LandingPage LandingPageURL LandingPage
UnixSocketPermission uint32 UnixSocketPermission uint32
SSH struct { SSH = struct {
Disabled bool `ini:"DISABLE_SSH"` Disabled bool `ini:"DISABLE_SSH"`
StartBuiltinServer bool `ini:"START_SSH_SERVER"` StartBuiltinServer bool `ini:"START_SSH_SERVER"`
Domain string `ini:"SSH_DOMAIN"` Domain string `ini:"SSH_DOMAIN"`
@ -91,6 +91,12 @@ var (
KeygenPath string `ini:"SSH_KEYGEN_PATH"` KeygenPath string `ini:"SSH_KEYGEN_PATH"`
MinimumKeySizeCheck bool `ini:"-"` MinimumKeySizeCheck bool `ini:"-"`
MinimumKeySizes map[string]int `ini:"-"` MinimumKeySizes map[string]int `ini:"-"`
}{
Disabled: false,
StartBuiltinServer: false,
Domain: "localhost",
Port: 22,
KeygenPath: "ssh-keygen",
} }
LFS struct { LFS struct {
@ -948,7 +954,7 @@ func newSessionService() {
// Mailer represents mail service. // Mailer represents mail service.
type Mailer struct { type Mailer struct {
// Mailer // Mailer
QueueLength int QueueLength int
Name string Name string
From string From string
@ -956,17 +962,17 @@ type Mailer struct {
EnableHTMLAlternative bool EnableHTMLAlternative bool
// SMTP sender // SMTP sender
Host string Host string
User, Passwd string User, Passwd string
DisableHelo bool DisableHelo bool
HeloHostname string HeloHostname string
SkipVerify bool SkipVerify bool
UseCertificate bool UseCertificate bool
CertFile, KeyFile string CertFile, KeyFile string
// Sendmail sender // Sendmail sender
UseSendmail bool UseSendmail bool
SendmailPath string SendmailPath string
} }
var ( var (
@ -982,22 +988,22 @@ func newMailService() {
} }
MailService = &Mailer{ MailService = &Mailer{
QueueLength: sec.Key("SEND_BUFFER_LEN").MustInt(100), QueueLength: sec.Key("SEND_BUFFER_LEN").MustInt(100),
Name: sec.Key("NAME").MustString(AppName), Name: sec.Key("NAME").MustString(AppName),
EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(), EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(),
Host: sec.Key("HOST").String(), Host: sec.Key("HOST").String(),
User: sec.Key("USER").String(), User: sec.Key("USER").String(),
Passwd: sec.Key("PASSWD").String(), Passwd: sec.Key("PASSWD").String(),
DisableHelo: sec.Key("DISABLE_HELO").MustBool(), DisableHelo: sec.Key("DISABLE_HELO").MustBool(),
HeloHostname: sec.Key("HELO_HOSTNAME").String(), HeloHostname: sec.Key("HELO_HOSTNAME").String(),
SkipVerify: sec.Key("SKIP_VERIFY").MustBool(), SkipVerify: sec.Key("SKIP_VERIFY").MustBool(),
UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(), UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(),
CertFile: sec.Key("CERT_FILE").String(), CertFile: sec.Key("CERT_FILE").String(),
KeyFile: sec.Key("KEY_FILE").String(), KeyFile: sec.Key("KEY_FILE").String(),
UseSendmail: sec.Key("USE_SENDMAIL").MustBool(), UseSendmail: sec.Key("USE_SENDMAIL").MustBool(),
SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"), SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"),
} }
MailService.From = sec.Key("FROM").MustString(MailService.User) MailService.From = sec.Key("FROM").MustString(MailService.User)