This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yuriy Bogdanov
committed
Jan 12, 2016
1 parent
d29faea
commit 9046ed6
Showing
10 changed files
with
492 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
vendor/src/github.com/grammarly/rocker/src/rocker/dockerclient/auth.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*- | ||
* Copyright 2015 Grammarly, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dockerclient | ||
|
||
import "github.com/fsouza/go-dockerclient" | ||
|
||
// GetAuthForRegistry extracts desired docker.AuthConfiguration object from the | ||
// list of docker.AuthConfigurations by registry hostname | ||
func GetAuthForRegistry(auth *docker.AuthConfigurations, registry string) (result docker.AuthConfiguration) { | ||
if auth == nil { | ||
return | ||
} | ||
// The default registry is "index.docker.io" | ||
if registry == "" { | ||
registry = "index.docker.io" | ||
} | ||
if result, ok := auth.Configs[registry]; ok { | ||
return result | ||
} | ||
if result, ok := auth.Configs["https://"+registry]; ok { | ||
return result | ||
} | ||
if result, ok := auth.Configs["https://"+registry+"/v1/"]; ok { | ||
return result | ||
} | ||
// not sure /v2/ is needed, but just in case | ||
if result, ok := auth.Configs["https://"+registry+"/v2/"]; ok { | ||
return result | ||
} | ||
if result, ok := auth.Configs["*"]; ok { | ||
return result | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.