mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-18 08:15:14 +00:00
Support unix_socket option of database (#623)
* Support unix_socket option of database * Set default auth plugin when use unix_socket --------- Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
@@ -104,18 +104,28 @@ func loadCcnetDB() {
|
||||
log.Fatalf("Unsupported database %s.", dbEngine)
|
||||
}
|
||||
|
||||
if key, err = section.GetKey("HOST"); err != nil {
|
||||
unixSocket := ""
|
||||
if key, err = section.GetKey("UNIX_SOCKET"); err == nil {
|
||||
unixSocket = key.String()
|
||||
}
|
||||
|
||||
host := ""
|
||||
if key, err = section.GetKey("HOST"); err == nil {
|
||||
host = key.String()
|
||||
} else if unixSocket == "" {
|
||||
log.Fatal("No database host in ccnet.conf.")
|
||||
}
|
||||
host := key.String()
|
||||
// user is required.
|
||||
if key, err = section.GetKey("USER"); err != nil {
|
||||
log.Fatal("No database user in ccnet.conf.")
|
||||
}
|
||||
user := key.String()
|
||||
if key, err = section.GetKey("PASSWD"); err != nil {
|
||||
password := ""
|
||||
if key, err = section.GetKey("PASSWD"); err == nil {
|
||||
password = key.String()
|
||||
} else if unixSocket == "" {
|
||||
log.Fatal("No database password in ccnet.conf.")
|
||||
}
|
||||
password := key.String()
|
||||
if key, err = section.GetKey("DB"); err != nil {
|
||||
log.Fatal("No database db_name in ccnet.conf.")
|
||||
}
|
||||
@@ -124,10 +134,6 @@ func loadCcnetDB() {
|
||||
if key, err = section.GetKey("PORT"); err == nil {
|
||||
port, _ = key.Int()
|
||||
}
|
||||
unixSocket := ""
|
||||
if key, err = section.GetKey("UNIX_SOCKET"); err == nil {
|
||||
unixSocket = key.String()
|
||||
}
|
||||
useTLS := false
|
||||
if key, err = section.GetKey("USE_SSL"); err == nil {
|
||||
useTLS, _ = key.Bool()
|
||||
|
Reference in New Issue
Block a user