Skip to content

Commit

Permalink
moves transform to Init()
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEvenson committed Mar 7, 2016
1 parent 5859c95 commit d1f2843
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ type DockerDriverConfig struct {
SSL bool `mapstructure:"ssl"` // Flag indicating repository is served via https
}

func (c *DockerDriverConfig) Init() error {
if strings.Contains(c.ImageName, "https://") {
c.SSL = true
c.ImageName = strings.Replace(c.ImageName, "https://", "", 1)
}

return nil
}

func (c *DockerDriverConfig) Validate() error {
if c.ImageName == "" {
return fmt.Errorf("Docker Driver needs an image name")
Expand Down Expand Up @@ -412,9 +421,8 @@ func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle
return nil, err
}

if strings.Contains(driverConfig.ImageName, "https://") {
driverConfig.SSL = true
driverConfig.ImageName = strings.Replace(driverConfig.ImageName, "https://", "", 1)
if err := driverConfig.Init(); err != nil {
return nil, err
}

image := driverConfig.ImageName
Expand Down

0 comments on commit d1f2843

Please sign in to comment.