()
| 36 | } |
| 37 | |
| 38 | func NewClient() (Client, error) { |
| 39 | var settingItem model.Setting |
| 40 | _ = global.DB.Where("key = ?", "DockerSockPath").First(&settingItem).Error |
| 41 | if len(settingItem.Value) == 0 { |
| 42 | settingItem.Value = "unix:///var/run/docker.sock" |
| 43 | } |
| 44 | cli, err := client.NewClientWithOpts(client.FromEnv, client.WithHost(settingItem.Value), client.WithAPIVersionNegotiation()) |
| 45 | if err != nil { |
| 46 | return Client{}, err |
| 47 | } |
| 48 | |
| 49 | return Client{ |
| 50 | cli: cli, |
| 51 | }, nil |
| 52 | } |
| 53 | |
| 54 | func NewClientWithExist(cli *client.Client) Client { |
| 55 | return Client{ |
no outgoing calls
no test coverage detected