diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2017-11-01 14:38:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-01 14:38:21 -0400 |
commit | f5019df3f5da9030ce21e5c8ad3d3921a6585e7f (patch) | |
tree | 05412dcc190ca026dbe51a4ef72bb91ff646e7c6 /libpod/common/docker_registry_options.go | |
parent | 2b74391cd5281f6fdf391ff8ad50fd1490f6bf89 (diff) | |
parent | eab0737f1189a7b88f0a37a6b894ca4345b6853f (diff) | |
download | podman-f5019df3f5da9030ce21e5c8ad3d3921a6585e7f.tar.gz podman-f5019df3f5da9030ce21e5c8ad3d3921a6585e7f.tar.bz2 podman-f5019df3f5da9030ce21e5c8ad3d3921a6585e7f.zip |
Merge pull request #1 from mheon/master
Initial checkin
Diffstat (limited to 'libpod/common/docker_registry_options.go')
-rw-r--r-- | libpod/common/docker_registry_options.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libpod/common/docker_registry_options.go b/libpod/common/docker_registry_options.go new file mode 100644 index 000000000..24fa5c03e --- /dev/null +++ b/libpod/common/docker_registry_options.go @@ -0,0 +1,34 @@ +package common + +import "github.com/containers/image/types" + +// DockerRegistryOptions encapsulates settings that affect how we connect or +// authenticate to a remote registry. +type DockerRegistryOptions struct { + // DockerRegistryCreds is the user name and password to supply in case + // we need to pull an image from a registry, and it requires us to + // authenticate. + DockerRegistryCreds *types.DockerAuthConfig + // DockerCertPath is the location of a directory containing CA + // certificates which will be used to verify the registry's certificate + // (all files with names ending in ".crt"), and possibly client + // certificates and private keys (pairs of files with the same name, + // except for ".cert" and ".key" suffixes). + DockerCertPath string + // DockerInsecureSkipTLSVerify turns off verification of TLS + // certificates and allows connecting to registries without encryption. + DockerInsecureSkipTLSVerify bool +} + +// GetSystemContext constructs a new system context from the given signaturePolicy path and the +// values in the DockerRegistryOptions +func (o DockerRegistryOptions) GetSystemContext(signaturePolicyPath, authFile string) *types.SystemContext { + sc := &types.SystemContext{ + SignaturePolicyPath: signaturePolicyPath, + DockerAuthConfig: o.DockerRegistryCreds, + DockerCertPath: o.DockerCertPath, + DockerInsecureSkipTLSVerify: o.DockerInsecureSkipTLSVerify, + AuthFilePath: authFile, + } + return sc +} |