diff --git a/api.go b/api.go index 88611b5..922299d 100755 --- a/api.go +++ b/api.go @@ -62,7 +62,7 @@ func Request(path string) ([]byte, *logger.HTTPError) { req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json") - ap := Option().Options + ap := Option() for _, api := range ap.API { req.Header.Set(api.Name, api.Value) } diff --git a/data.go b/data.go index c5d3251..2117fd0 100644 --- a/data.go +++ b/data.go @@ -4,26 +4,25 @@ import ( "time" ) -// Options main program options type Options struct { Title string `json:"title"` Description string `json:"description"` Site string `json:"site"` - Options struct { + Server struct { Address string `json:"address"` Port int `json:"port"` - Ace struct { - DynamicReload bool `json:"DynamicReload"` - BaseDir string `json:"BaseDir"` - } `json:"ace"` - API []struct { - Name string `json:"name"` - Value string `json:"value"` - } `json:"api"` - } `json:"options"` + } `json:"server"` + Ace struct { + DynamicReload bool `json:"DynamicReload"` + BaseDir string `json:"BaseDir"` + } `json:"ace"` + API []struct { + Name string `json:"name"` + Value string `json:"value"` + } `json:"api"` Database struct { Server string `json:"server"` - DB string `json:"db"` + Db string `json:"db"` User string `json:"user"` Passwd string `json:"passwd"` } `json:"database"` diff --git a/database.go b/database.go index 6abc3c7..34efcab 100644 --- a/database.go +++ b/database.go @@ -8,7 +8,7 @@ import ( func dbConnect() *sql.DB { resp := Option().Database - db, err := sql.Open("mysql", resp.User+":"+resp.Passwd+"@tcp("+resp.Server+")/"+resp.DB) + db, err := sql.Open("mysql", resp.User+":"+resp.Passwd+"@tcp("+resp.Server+")/"+resp.Db) if err != nil { fmt.Println(err) } else {