File tree Expand file tree Collapse file tree 4 files changed +33
-3
lines changed
Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ func WithClientConfig(dockerConfig config.DockerConfig) DebugCliOption {
121121 }
122122 clientOpts := []client.Opt {
123123 client .WithHost (host ),
124- client .WithVersion ("" ),
124+ client .WithVersion (dockerConfig . Version ),
125125 }
126126 if dockerConfig .TLS {
127127 clientOpts = append (clientOpts , client .WithTLSClientConfig (
Original file line number Diff line number Diff line change 44 "encoding/json"
55 "fmt"
66 "github.com/BurntSushi/toml"
7+ "github.com/docker/docker/api"
78 "github.com/mitchellh/go-homedir"
89 "github.com/pkg/errors"
910 "github.com/zeromake/docker-debug/pkg/opts"
@@ -47,6 +48,7 @@ func init() {
4748
4849// DockerConfig docker 配置
4950type DockerConfig struct {
51+ Version string `toml:"version"`
5052 Host string `toml:"host"`
5153 TLS bool `toml:"tls"`
5254 CertDir string `toml:"cert_dir"`
@@ -128,7 +130,8 @@ func InitConfig() (*Config, error) {
128130 }
129131 }
130132 dc := DockerConfig {
131- Host : host ,
133+ Host : host ,
134+ Version : api .DefaultVersion ,
132135 }
133136 certPath := os .Getenv ("DOCKER_CERT_PATH" )
134137 if tlsVerify && certPath != "" {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ type migration struct {
1212 Version semver.Version
1313}
1414
15- var migrationArr = []* migration {}
15+ var migrationArr []* migration
1616
1717// MigrationConfig migration config version
1818func MigrationConfig (conf * Config ) error {
Original file line number Diff line number Diff line change 1+ package config
2+
3+ import (
4+ "github.com/blang/semver"
5+ "github.com/docker/docker/api"
6+ )
7+
8+ // Up000702 update version 0.7.2
9+ func Up000702 (conf * Config ) error {
10+ for _ , c := range conf .DockerConfig {
11+ if c .Version == "" {
12+ c .Version = api .DefaultVersion
13+ }
14+ }
15+ return nil
16+ }
17+
18+ func init () {
19+ v , err := semver .Parse ("0.7.2" )
20+ if err != nil {
21+ return
22+ }
23+ migrationArr = append (migrationArr , & migration {
24+ Up : Up000702 ,
25+ Version : v ,
26+ })
27+ }
You can’t perform that action at this time.
0 commit comments