mirror of
https://gitee.com/goploy/goploy.git
synced 2024-11-29 18:57:59 +08:00
Fixed: file compare missing server id
This commit is contained in:
parent
6c9eda7fa8
commit
ae73747b12
@ -333,9 +333,9 @@ func (Deploy) FileCompare(gp *server.Goploy) server.Response {
|
||||
|
||||
distPath := path.Join(project.Path, reqData.FilePath)
|
||||
for _, projectServer := range projectServers {
|
||||
go func(server model.Server) {
|
||||
fileCompare := FileCompareData{server.Name, server.IP, server.ID, "no change", false}
|
||||
client, err := server.ToSSHConfig().Dial()
|
||||
go func(projectServer model.ProjectServer) {
|
||||
fileCompare := FileCompareData{projectServer.Server.Name, projectServer.Server.IP, projectServer.ServerID, "no change", false}
|
||||
client, err := projectServer.ToSSHConfig().Dial()
|
||||
if err != nil {
|
||||
fileCompare.Status = "client error"
|
||||
ch <- fileCompare
|
||||
@ -368,7 +368,7 @@ func (Deploy) FileCompare(gp *server.Goploy) server.Response {
|
||||
return
|
||||
}
|
||||
ch <- fileCompare
|
||||
}(projectServer.Server)
|
||||
}(projectServer)
|
||||
}
|
||||
|
||||
for i := 0; i < len(projectServers); i++ {
|
||||
|
@ -44,11 +44,8 @@ func Init() {
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(&Toml)
|
||||
// 遍历结构体的字段
|
||||
for i := 0; i < v.Elem().NumField(); i++ {
|
||||
// 获取每个字段的值
|
||||
fieldValue := v.Elem().Field(i)
|
||||
// 获取到每个字段的值对应的接口
|
||||
config := fieldValue.Addr().Interface()
|
||||
if c, ok := config.(SetDefault); ok {
|
||||
c.SetDefault()
|
||||
|
@ -1,8 +1,6 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/zhenorzz/goploy/config"
|
||||
"github.com/zhenorzz/goploy/database"
|
||||
"testing"
|
||||
@ -10,22 +8,18 @@ import (
|
||||
|
||||
func TestInitDB(t *testing.T) {
|
||||
config.Init()
|
||||
db, err := sql.Open(config.Toml.DB.Type, fmt.Sprintf(
|
||||
"%s:%s@(%s:%s)/?charset=utf8mb4,utf8\n",
|
||||
config.Toml.DB.User,
|
||||
config.Toml.DB.Password,
|
||||
config.Toml.DB.Host,
|
||||
config.Toml.DB.Port))
|
||||
db, err := Open(config.Toml.DB)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := CreateDB(db, config.Toml.DB.Database); err != nil {
|
||||
if err := db.CreateDB(config.Toml.DB.Database); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := UseDB(db, config.Toml.DB.Database); err != nil {
|
||||
if err := db.UseDB(config.Toml.DB.Database); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := ImportSQL(db, database.GoploySQL); err != nil {
|
||||
if err := db.ImportSQL(database.GoploySQL); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user