mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 22:20:12 +01:00
Rework TLS support, remove unsupported options
This commit is contained in:
parent
69db640b98
commit
42fea79860
3 changed files with 43 additions and 148 deletions
|
|
@ -2,7 +2,6 @@ package container
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
|
@ -15,11 +14,6 @@ const (
|
|||
defaultStopSignal = "SIGTERM"
|
||||
)
|
||||
|
||||
var username = os.Getenv("REPO_USER")
|
||||
var password = os.Getenv("REPO_PASS")
|
||||
var email = os.Getenv("REPO_EMAIL")
|
||||
var api_version = "1.24"
|
||||
|
||||
// A Filter is a prototype for a function that can be used to filter the
|
||||
// results from a call to the ListContainers() method on the Client.
|
||||
type Filter func(Container) bool
|
||||
|
|
@ -33,13 +27,16 @@ type Client interface {
|
|||
RenameContainer(Container, string) error
|
||||
IsContainerStale(Container) (bool, error)
|
||||
RemoveImage(Container) error
|
||||
RegistryLogin(string) error
|
||||
}
|
||||
|
||||
// NewClient returns a new Client instance which can be used to interact with
|
||||
// the Docker API.
|
||||
func NewClient(dockerHost string, pullImages bool) Client {
|
||||
cli, err := dockerclient.NewClient(dockerHost, api_version, nil, nil)
|
||||
// The client reads its configuration from the following environment variables:
|
||||
// * DOCKER_HOST the docker-engine host to send api requests to
|
||||
// * DOCKER_TLS_VERIFY whether to verify tls certificates
|
||||
// * DOCKER_API_VERSION the minimum docker api version to work with
|
||||
func NewClient(pullImages bool) Client {
|
||||
cli, err := dockerclient.NewEnvClient()
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Error instantiating Docker client: %s", err)
|
||||
|
|
@ -53,11 +50,6 @@ type dockerClient struct {
|
|||
pullImages bool
|
||||
}
|
||||
|
||||
func (client dockerClient) RegistryLogin(registryURL string) error {
|
||||
log.Debug("Login not implemented")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (client dockerClient) ListContainers(fn Filter) ([]Container, error) {
|
||||
cs := []Container{}
|
||||
bg := context.Background()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue