You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
464 B
30 lines
464 B
4 years ago
|
package common
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"github.com/taoshihan1991/imaptool/tools"
|
||
|
"io/ioutil"
|
||
|
)
|
||
|
|
||
|
type Mysql struct {
|
||
|
Server string
|
||
|
Port string
|
||
|
Database string
|
||
|
Username string
|
||
|
Password string
|
||
|
}
|
||
|
|
||
|
func GetMysqlConf() *Mysql {
|
||
|
var mysql = &Mysql{}
|
||
|
isExist, _ := tools.IsFileExist(MysqlConf)
|
||
|
if !isExist {
|
||
|
return mysql
|
||
|
}
|
||
|
info, err := ioutil.ReadFile(MysqlConf)
|
||
|
if err != nil {
|
||
|
return mysql
|
||
|
}
|
||
|
err = json.Unmarshal(info, mysql)
|
||
|
return mysql
|
||
|
}
|