diff --git a/handlers/bootstrap.go b/handlers/bootstrap.go index 00573ef..3c7e3f0 100644 --- a/handlers/bootstrap.go +++ b/handlers/bootstrap.go @@ -240,14 +240,18 @@ func initOauthProviders(p *types.Playground) { config.Providers[p.Id]["facebook"] = conf } if p.DockerClientID != "" && p.DockerClientSecret != "" { - oauth2.RegisterBrokenAuthHeaderProvider(".id.docker.com") + endpoint := "id.docker.com" + if len(p.DockerHost) > 0 { + endpoint = p.DockerHost + } + oauth2.RegisterBrokenAuthHeaderProvider(fmt.Sprintf(".%s", endpoint)) conf := &oauth2.Config{ ClientID: p.DockerClientID, ClientSecret: p.DockerClientSecret, Scopes: []string{"openid"}, Endpoint: oauth2.Endpoint{ - AuthURL: "https://id.docker.com/id/oauth/authorize/", - TokenURL: "https://id.docker.com/id/oauth/token", + AuthURL: fmt.Sprintf("https://%s/id/oauth/authorize/", endpoint), + TokenURL: fmt.Sprintf("https://%s/id/oauth/token", endpoint), }, } diff --git a/pwd/types/playground.go b/pwd/types/playground.go index 5fc34f7..93ddd4a 100644 --- a/pwd/types/playground.go +++ b/pwd/types/playground.go @@ -87,5 +87,6 @@ type Playground struct { FacebookClientSecret string `json:"facebook_client_secret" bson:"facebook_client_secret"` DockerClientID string `json:"docker_client_id" bson:"docker_client_id"` DockerClientSecret string `json:"docker_client_secret" bson:"docker_client_secret"` + DockerHost string `json:"docker_host" bson:"docker_host"` MaxInstances int `json:"max_instances" bson:"max_instances"` }