Skip to content

Commit

Permalink
feature(pkg): add method to create docker connector with client instance
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybarreto committed May 22, 2024
1 parent 244d34c commit da56787
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/agent/connector/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ func LoadConfigFromEnv() (*Config, map[string]interface{}, error) {
return cfg, nil, nil
}

func NewDockerConnectorWithClient(cli *dockerclient.Client, server string, tenant string, privateKey string) (Connector, error) {
return &DockerConnector{
server: server,
tenant: tenant,
cli: cli,
privateKeys: privateKey,
cancels: make(map[string]context.CancelFunc),
}, nil
}

// NewDockerConnector creates a new [Connector] that uses Docker as the container runtime.
func NewDockerConnector(server string, tenant string, privateKey string) (Connector, error) {
cli, err := dockerclient.NewClientWithOpts(dockerclient.FromEnv, dockerclient.WithAPIVersionNegotiation())
Expand Down

0 comments on commit da56787

Please sign in to comment.